失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > python与R行列数据过滤(row column filtering):dplyr isnull isna drop select iloc loc isin filter

python与R行列数据过滤(row column filtering):dplyr isnull isna drop select iloc loc isin filter

时间:2020-07-26 09:00:57

相关推荐

python与R行列数据过滤(row column filtering):dplyr  isnull isna drop select iloc loc isin filter

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》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。