Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dropna not working
#4
This does work thanks.

Is there a solution 'non column' specific?

So I really only want to remove rows where the whole row is empty (or with empty strings). This solution is based on if the rows of 'Column name' are empty as opposed to the complete row i.e across all columns.

I have used this before but is there a more elegant way?

for index, row in df.iterrows():                                                            #loop through rows of df for further df cleaning
            if row.any() == '':
                df.drop(index,inplace=True)
Reply


Messages In This Thread
Dropna not working - by WiPi - May-15-2020, 12:01 PM
RE: Dropna not working - by scidam - May-15-2020, 12:09 PM
RE: Dropna not working - by hussainmujtaba - May-15-2020, 12:20 PM
RE: Dropna not working - by WiPi - May-15-2020, 01:26 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Shocked kindly support with this dropna function not working gheevarpaulosejobs 2 678 Jul-24-2023, 03:41 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020