I am trying to delete every rows in my dataframe which is having morethan 5 number of NaN values against my 'Station Id'. I have obtained the Index number of rows which has morethan 5 NaN values by using 'for' loop. I stored every index number of rows in a 1D list. Then I am trying to delete rows according to index number one by one by implimenting another 'for' loop as shown below,
my dataframe name is = df_data_3 ###(164040 rows × 12 columns)
null_rows_index = [list of number of indexes] ### 261 number, that means 261 rows which has morethan 5 NaN values
j = 0
for j in range(len(null_rows_index)):
df_data_3 = df_data_3.drop(index=[null_rows_index[j]], inplace = True)
but this shows an error while running as below,
'NoneType' object has no attribute 'drop'
How would I drop the multiple rows?