In this article, you’ll see how to drop rows with NaN values in Pandas DataFrame
Figure 1
Figure 2
import pandas as pd
dataFrame = pd.DataFrame({
'values1': ['Bahadir','23','34','Melissa','44','89'],
'values2': ['54','38','Antony','24','35','Julia']
})
dataFrame = dataFrame.apply (pd.to_numeric, errors='coerce')
dataFrame = dataFrame.dropna()
dataFrame = dataFrame.reset_index(drop=True)
print (dataFrame)
Hope to
see you in the next article. Happy coding
No comments:
Post a Comment