Try this
import pandas as pd
import numpy as np
df = pd.DataFrame({'A':[1,2,3,''], 'B': [4,5,'', 6]})
df = df.replace('', np.nan)
df = df.dropna()
print(df)
Output:
A B
0 1.0 4.0
1 2.0 5.0
You can delete column using del
del df['column_name']
This works I think -
df = df.dropna(axis=0, subset=['Column name'])
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.