Pandas deleting row with df.drop doesn't work
I have a DataFrame like this (first column is index
(786...) and second day
(25...) and Rainfall amount
is empty):
Day Rainfall amount (millimetres)
786 25
787 26
788 27
789 28
790 29
791 1
792 2
793 3
794 4
795 5
and I want to delete the row 790. I tried so many things with df.drop but nothin happend.
I hope you can help me.
Solution 1:
While dropping new DataFrame returns. If you want to apply changes to the current DataFrame you have to specify inplace
parameter.
Option 1
Assigning back to df
-
df = df.drop(790)
Option 2
Inplace argument -
df.drop(790, inplace=True)