In the dataframe, I am trying to find numeric data columns which has dtype as "object". I want to do it automated way rather then looking into actual data within the dataframe.
I tried this, but it didn't work:
for obj_feature in df.select_dtypes(include="object").columns:
if df[obj_feature].str.isalpha == False:
print("Numeric data columns", obj_feature)
DDL to generate Dataframe:
import pandas as pd
df = pd.DataFrame({'id': [1, 2, 3],
'A': ['Month', 'Year', 'Quater'],
'B' : ['29.85', '85.43', '33.87'],
'C' : [45, 22, 33.4]})
Sorry forgot to add this: Expected Output: Pick Dataframe columns, B since it has numeric data values, but it has 'object' dtype.
Thanks!