对于当前的项目,我计划清除PandasDataFrame的空值。为此,我想使用pd.DataFrame().fillna(),它显然是数据清理的可靠解决方案。我尝试了几种方法来重写df = pd.DataFrame().fillna()行,但都没有达到预期的结果。 有没有什么聪明的调整可以让它运行起来?import stringimport pandas as pd
# Loading and normalising the input f
对于当前的项目,我计划清除PandasDataFrame的空值。为此,我想使用Pandas.DataFrame.fillna,它显然是用于数据清理的可靠孤立子。但是,在运行下面的代码时,我收到了以下错误AttributeError: module 'pandas' has no attribute 'df'。我尝试了几种方法来重写df = pd.df().fillna行,但都没有改变结果。 有没有什么聪明的调整可以让它运行起来?
我尝试使用columns.fillna(column.mean)从两列中删除空格和空格,并将它们替换为各自列中的平均值,但在实现以下代码时,它告诉我“列未定义”。如何定义在数据框中定义为参数的列,以便应用columns.fillna(column.mean)方法?import pandas as pdimport matplotlib.pyplot as plt
points
print(training_df.isnull().values.any()) # Prints true because we just inserted nansprint(test.isnull().values.any()) # Check afterwardstraining_df.fillna(train