[英]Why I can't delete the rows in python?
I am trying to delete the rows with missing values in python and the code runs but with no effect whatsoever.我正在尝试删除 python 中缺少值的行,并且代码运行但没有任何效果。 The rows are not deleted.
行不会被删除。 I've added also a screenshot of my xls file.
我还添加了我的 xls 文件的屏幕截图。
This is how my code looks like:这就是我的代码的样子:
df = Pandas.read_excel('C:/Downloads/Report.xls')
engine='python'
new_df = df.dropna(inplace = true)
puts new_df.to_string()
I've tried also with: new_df = df.dropna(axis=0, how="any", inplace=false)
OR new_df = df.dropna()
我也尝试过:
new_df = df.dropna(axis=0, how="any", inplace=false)
OR new_df = df.dropna()
IT DOES NOT DELETE THE ROWS.它不会删除行。
I get the following result: Unnamed: 2 0 asset_number 1 WG0000000000 2 WG0000204381 3 WG0000204381 4 WG0000204381 5 WG0000204379 6 WG0000204379 7 WG0000204379 8 WG0000204366 9 WG0000204366 10 WG0000204366 11 WG0000204368... I get the following result: Unnamed: 2 0 asset_number 1 WG0000000000 2 WG0000204381 3 WG0000204381 4 WG0000204381 5 WG0000204379 6 WG0000204379 7 WG0000204379 8 WG0000204366 9 WG0000204366 10 WG0000204366 11 WG0000204368...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.