I have this dataset in which one of the columns has empty rows and some strings, whereas I only need to keep the numeric ones.
I have tried this for the strings:
df_3 = df_cor_inc[['Person ID','rt']]
df5 = df_3.to_csv('Documents/a.csv',index=False)
df5['rt'].apply(lambda x: pd.to_numeric(x, errors = 'coerce')).dropna()
But I get: AttributeError: 'NoneType' object has no attribute 'dropna'.
This doesn't work either because 'AttributeError: 'NoneType' object has no attribute 'rt':
df5[df5.rt.apply(lambda x: x.isnumeric())]
Same thing happens when I try to get rid of the empty rows, I get an error because I have 'NoneType'. How do I get rid of it so that I only keep the numeric values of that column and delete all the rows that don't have them?
This is how the data looks:
Person ID,rt
0,445
0,445
0,445
1,
1,
1,
1,
1,Wait success
1,
1,
1,
1,
1,
1,Wait success
1,
1,
1,
1,
1,
1,Wait success
1,
1,
1,
1,
1,
1,Wait success
1,
1,
1,
1,
1,
1,Wait success
1,
1,
1,
1,
1,
1,Wait success
1,
1,
1,
1,
1,
1,Wait success
1,
1,
1,
1,
1,
1,Wait success
1,
1,
1,
1,
1,
1,Wait success
1,
1,
1,
1,
1,
1,1230
1,1230
1,1230
1,1230
1,1230
1,1230
1,1721
1,1721
1,1721
1,1721
1,1721
1,1721
df5isNonetype, notDataFrame