# Check for None and NaN values in the dataframe and clean if needed
print("Any NaN values in the dataframe? True or False", end='\n')
display(dfManual_With_NaN.isnull().values.any())
print("", end='\n')
Output: True
print("Total Number of NaN values in the dataframe", end='\n')
display(dfManual_With_NaN.isnull().sum().sum())
print("", end='\n')
Output: 1
print("Display the total number of rows with a NaN", end='\n')
df_NaN_Rows = dfManual_With_NaN[dfManual_With_NaN.isnull().T.any().T]
display(df_NaN_Rows.head(100))
print("", end='\n')
Output:
# Update None and NaN to zero
dfManual_Booked = dfManual_With_NaN.fillna(value='NaN', inplace=True) # Replace None values with NaN
dfManual_Booked = dfManual_Booked.fillna(0) # Replace NaN with 0.
Errors here: 'NoneType' object has no attribute 'isnull'
Поэтому я обновляю None для значений NaN, а затем пытаюсь установить для всех NaN значение 0. Любые указания относительно причин сбоя?