【发布时间】:2020-04-19 13:39:31
【问题描述】:
数据集:我正在处理的数据框的名称是“f500”。这里是 first five rows in the dataframe
目标:选择只有数值的数据
我的尝试:
1) 我尝试使用布尔数组来过滤掉非数字值并且没有错误。
numeric_only_bool = (f500.dtypes != object)
2) 但是,当我尝试使用该布尔数组进行索引时,会发生错误。
numeric_only = f500[:, numeric_only_bool]
我看到了 index-wise(row-wise) 布尔索引示例,但找不到按列的布尔索引。 任何人都可以帮助如何修复此代码?
提前谢谢你。
【问题讨论】: