Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个超过 500 列的稀疏数据框。我想删除条目总和小于阈值 100 的列。如何在 Python 中执行此操作?
在 RI 中可以使用:
df2 <- df51[,colSums(df51) >= 100]
在python中,这转化为
df2 = df1.drop(df1.columns[df1.sum() >= 100], axis=1)
axis=1 选项用于删除列,而 axis=0 用于行。