mean

Group by column in pandas dataframe and average arrays

旧街凉风 提交于 2020-01-03 16:43:53
问题 I have a movie dataframe with movie names, their respective genre, and vector representation (numpy arrays). ID Year Title Genre Word Vector 1 2003.0 Dinosaur Planet Documentary [-0.55423898, -0.72544044, 0.33189204, -0.1720... 2 2004.0 Isle of Man TT 2004 Review Sports & Fitness [-0.373265237, -1.07549703, -0.469254494, -0.4... 3 1997.0 Character Foreign [-1.57682264, -0.91265768, 2.43038678, -0.2114... 4 1994.0 Paula Abdul's Get Up & Dance Sports & Fitness [0.3096168, -0.57186663, 0

deleting outlier in r with account of nominal var

我与影子孤独终老i 提交于 2020-01-02 20:09:14
问题 Say, i have three columns x <- c(-10, 1:6, 50) x1<- c(-20, 1:6, 60) z<- c(1,2,3,4,5,6,7,8) check outliers for x bx <- boxplot(x) bx$out check outliers for x1 bx1 <- boxplot(x1) bx1$out now we must delete outliers x <- x[!(x %in% bx$out)] x x1 <- x1[!(x1 %in% bx1$out)] x1 but we have variable Z(nominal) and we must remove observations, which correspond to the outlier of variables x and x1, in our case it is 1 and 8 obs. of Z How to do it? in output we must have x x1 z Na Na Na 1 1 2 2 2 3 3 3

Plotting mean ROC curve for multiple ROC curves, R

試著忘記壹切 提交于 2020-01-02 12:47:09
问题 I have a dataset of 100 samples, each of which has 195 mutations with their corresponding known clinical significance ("RealClass") and predicted value according to some prediction tool ("PredictionValues") For the demonstration, this is a random dataset that has the same structure as my dataset: predictions_100_samples<-as.data.frame(matrix(nrow=19500,ncol=3)) colnames(predictions_100_samples)<-c("Sample","PredictionValues","RealClass") predictions_100_samples$Sample<-rep(c(1:100), each =

The as.numeric function changes the values in my dataframe [duplicate]

五迷三道 提交于 2020-01-02 05:43:28
问题 This question already has answers here : How to convert a factor to integer\numeric without loss of information? (8 answers) Closed 5 years ago . I have a column containing speed measurements which I need to change to numeric so that I can use both the mean and sum functions. However, when I do convert them the values change substantially. Why is this? This is what my data look like at first: And here is the structure of the data frame: 'data.frame': 1899571 obs. of 20 variables: $ pcd :

Calculating mean date by row

倾然丶 夕夏残阳落幕 提交于 2020-01-02 03:47:07
问题 I wish to obtain the mean date by row, where each row contains two dates. Eventually I found a way, posted below. However, the approach I used seems rather cumbersome. Is there a better way? my.data = read.table(text = " OBS MONTH1 DAY1 YEAR1 MONTH2 DAY2 YEAR2 STATE 1 3 6 2012 3 10 2012 1 2 3 10 2012 3 20 2012 1 3 3 16 2012 3 30 2012 1 4 3 20 2012 4 8 2012 1 5 3 20 2012 4 9 2012 1 6 3 20 2012 4 10 2012 1 7 3 20 2012 4 11 2012 1 8 4 4 2012 4 5 2012 1 9 4 6 2012 4 6 2012 1 10 4 6 2012 4 7 2012

What's the quickest way to get the mean of a set of numbers from the command line?

喜夏-厌秋 提交于 2020-01-02 00:59:11
问题 Using any tools which you would expect to find on a nix system (in fact, if you want, msdos is also fine too), what is the easiest/fastest way to calculate the mean of a set of numbers, assuming you have them one per line in a stream or file? 回答1: Awk awk '{total += $1; count++ } END {print total/count}' 回答2: awk ' { n += $1 }; END { print n / NR }' This accumulates the sum in n , then divides by the number of items ( NR = Number of Records). Works for integers or reals. 回答3: Using Num-Utils

使用ab对nginx进行压力测试

你。 提交于 2020-01-01 09:01:32
nginx以高并发,省内存著称。 相信大多数安装nginx的同学都想知道自己的nginx性能如何。 我想跟大家分享下我使用ab工具的压力测试方法和结果, ab是针对apache的性能测试工具,可以只安装ab工具。 ubuntu安装ab apt-get install apache2-utils centos安装ab yum install httpd-tools 测试之前需要准备一个简单的html、一个php、一个图片文件。 分别对他们进行测试。 我们把这个三个文件放到nginx安装目录默认的html目录下, 准备之后我们就可以测试了 ab -kc 1000 -n 1000 http://localhost/ab.html 这个指令会使用1000个并发,进行连接1000次。结果如下 root@~# ab -kc 1000 -n 1000 http://www.nginx.cn/ab.html This is ApacheBench, Version 2.3 <$Revision: 655654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/

使用ab对nginx进行压力测试

落爺英雄遲暮 提交于 2020-01-01 09:00:59
nginx以高并发,省内存著称。 相信大多数安装nginx的同学都想知道自己的nginx性能如何。 我想跟大家分享下我使用ab工具的压力测试方法和结果, ab是针对apache的性能测试工具,可以只安装ab工具。 yum install httpd - tools 测试之前需要准备一个简单的html、一个php、一个图片文件。 分别对他们进行测试。 我们把这个三个文件放到nginx安装目录默认的html目录下, 准备之后我们就可以测试了 ab -kc 1000 -n 1000 http://localhost/ab.html 这个指令会使用1000个并发,进行连接1000次。结果如下 root@~# ab -kc 1000 -n 1000 http://www.nginx.cn/ab.html This is ApacheBench, Version 2.3 <$Revision: 655654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking www.nginx.cn (be patient) Completed 100

MEAN.js Social Sharing?

烈酒焚心 提交于 2020-01-01 06:18:19
问题 So I built an app using MEAN.js, and I made some updates to the Articles (blog) section for better SEO, readability, design, etc. One problem I can't seem to figure out, though, is how to share the Articles using Facebook, Google+, Twitter, etc. and have them populate the right data using og meta tags. WHAT I WANT All I want is to be able to share Articles (blog posts) from my MEAN.js application, and have the article content show up when I post the link in Social sites (e.g. Facebook). WHAT

MEAN.js Social Sharing?

Deadly 提交于 2020-01-01 06:15:19
问题 So I built an app using MEAN.js, and I made some updates to the Articles (blog) section for better SEO, readability, design, etc. One problem I can't seem to figure out, though, is how to share the Articles using Facebook, Google+, Twitter, etc. and have them populate the right data using og meta tags. WHAT I WANT All I want is to be able to share Articles (blog posts) from my MEAN.js application, and have the article content show up when I post the link in Social sites (e.g. Facebook). WHAT