更新时间:2023-11-28 18:51:46
您可以使用 pd.to_numeric
和布尔索引的输出。
You can use the outputs from pd.to_numeric
and boolean indexing.
仅获取字符串使用:
df[pd.to_numeric(df.SIC, errors='coerce').isnull()]
输出:
SIC
5 shine
6 add
8 Nan
9 string
获得仅数字使用:
df[pd.to_numeric(df.SIC, errors='coerce').notnull()]
输出:
SIC
1 246804
2 135272
3 898.01
4 3453.33
7 522
10 29.11
11 20