【发布时间】:2014-09-22 05:49:41
【问题描述】:
我正在通过复制一些 R 小插曲的郊游来学习 Pandas 包。现在我以 R 中的 dplyr 包为例:
http://cran.rstudio.com/web/packages/dplyr/vignettes/introduction.html
R 脚本
planes <- group_by(hflights_df, TailNum)
delay <- summarise(planes,
count = n(),
dist = mean(Distance, na.rm = TRUE))
delay <- filter(delay, count > 20, dist < 2000)
Python 脚本
planes = hflights.groupby('TailNum')
planes['Distance'].agg({'count' : 'count',
'dist' : 'mean'})
如何在 python 中明确声明 NA 需要跳过?
【问题讨论】: