Filtering string/float/integer values in pandas dataframe columns
You can use the outputs from pd.to_numeric
and boolean indexing.
To get only the strings use:
df[pd.to_numeric(df.SIC, errors='coerce').isnull()]
Output:
SIC
5 shine
6 add
8 Nan
9 string
To get only the numbers use:
df[pd.to_numeric(df.SIC, errors='coerce').notnull()]
Output:
SIC
1 246804
2 135272
3 898.01
4 3453.33
7 522
10 29.11
11 20