python与R行列数据过滤(row column filtering):dplyr、 isnull、isna、drop、select、iloc、loc、isin、filter
很多工程师可能刚开始的时候只熟悉python或者R其中的一个进行数据科学相关的任务。
那么如果我们对比这学习可以快速了解语言设计背后的思想,我们学习和切换的速度就会更快,实现事倍功半的效果。
# python行过滤:
# 过滤条件为第一个字段的内容需要大于3,第二个字段你的内容必须缺失;
df[(df[column_1] > 3) & (df[column_2].isnull())]
# R行过滤;
#过滤条件为第一个字段的内容需要大于3,第二个字段你的内容必须缺失;
df[(df$column_1 > 3) & (is.na(df$column_2)), ]
# python进行多列筛选 df[[c1, c2]]
# R进行多列筛选 df[c(c1, c2)]
# python pandas使用drop函数删除特定列:
df.drop([c1, c2], axis=1)
# R使用dplyr包se
如果觉得《python与R行列数据过滤(row column filtering):dplyr isnull isna drop select iloc loc isin filter》对你有帮助,请点赞、收藏,并留下你的观点哦!