1import pandas as pd
2
3df = pd.DataFrame({'values_1': ['700','ABC','500','XYZ','1200'],
4 'values_2': ['DDD','150','350','400','5000']
5 })
6
7df = df.apply (pd.to_numeric, errors='coerce')
8df = df.dropna()
9df = df.reset_index(drop=True)
10
11print (df)
12
1#return a subset of the dataframe where the column name value != NaN
2df.loc[df['column name'].isnull() == False]
1In [30]: df.dropna(subset=[1]) #Drop only if NaN in specific column (as asked in the question)
2Out[30]:
3 0 1 2
41 2.677677 -1.466923 -0.750366
52 NaN 0.798002 -0.906038
63 0.672201 0.964789 NaN
75 -1.250970 0.030561 -2.678622
86 NaN 1.036043 NaN
97 0.049896 -0.308003 0.823295
109 -0.310130 0.078891 NaN
11