I have been looking this site and google for an answer to my question, but they all apply to columns.
In my data set there are a couple of cells which only contain a space, instead of NaN. So I would like to drop all the rows there this is the case. I know I can use the code below to do so per column. But how do I apply this to the entire dataframe?
df= df[df.column != ' ']
If need remove all rows with space at least in one column add DataFrame.all for test if all values per rows are Trues:
DataFrame.all
True
df= df[(df != ' ').all(axis=1)]
2.1m questions
2.1m answers
60 comments
57.0k users