I have a dataframe column whose curren ...
1 Answer
Use pd.to_numeric with errors='coerce' parameter:
df['Sno'] = pd.to_numeric(df['Sno'], errors='coerce')
df = df[df['Sno'].notna()].astype({'Sno': int})
Output:
>>> df
Sno test
0 12 5
1 14 5
2 15 7
3 16 8
4 17 9