I'm attempting to go through each row in a data frame and checking if selected row has more than 3 null values (this part works) and then deleting the entire row. However, upon trying to drop said rows from the data frame, I'm met with an error:
AttributeError: 'NoneType' object has no attribute 'index'
Forgive me if this code is inefficient, I only need it to work.
import pandas as pd
df = pd.read_csv('data/mycsv.csv')
i = 0
while i < len(df.index):
if df.iloc[i].isnull().sum() > 3:
df = df.drop(df.index[i], inplace = True)
i += 1