Reputation: 97
I have a dataframe where there is one empty row every 10 rows, it looks like the following
A B C D E
0
1 a b c d e
2 f g h i j
.....
I would like to drop the empty row in the dataframe, but the problem is the row is not filled with empty string " "
, they are more like ""
.
Therefore, the df.fillna
and df.dropna
both do not work and I'm not sure how to replace them.
Any suggestion would be helpful! Thank you guys!
Upvotes: 1
Views: 149
Reputation: 862396
Filter all rows with no empty values like:
df = df[df.ne('').all(axis=1)]
Upvotes: 4
Reputation: 72
If it's every 10 rows as you say you may do something like:
df_clean = df[df.index % 10 != 0]
Which will drop every 10th row starting at the first one.
Upvotes: 0