import pandas as pd
# 删除含有空数据的全部行
df4 = pd.read_csv('4.csv', encoding='utf-8')
df4 = df4.dropna()
# 可以通过axis参数来删除含有空数据的全部列
df4 = df4.dropna(axis=1)
# 可以通过subset参数来删除在age和sex中含有空数据的全部行
df4 = df4.dropna(subset=["age", "sex"])
print(df4)
df4 = df4.dropna(subset=['age', 'body','home.dest'])