Dropping Nan Rows Doesn't Work In Pandas
I have a file with about 7k rows and 4 columns. A lot of the cells are empty and I have tried to drop them using a number of pandas functions but nothing seems to work. Functions I
Solution 1:
dropna
is not an inplace operation, you need to reassign it back to the variable or use the inplace
parameter set to True.
df = df.dropna(axis=0, how='all')
or
df.dropna(axis=0, how='all', inplace=True)
Edit
Jay points out in the comments that, you need to reorder you code logic such that you dropna after the read_csv.
Post a Comment for "Dropping Nan Rows Doesn't Work In Pandas"