How to remove blank lines from dataframe

Question:

          Type         Channel       Agt
0                                       
1     ServiceList          DCS          
2                                       
3                                       
4     ServiceList          WEB          
5                                       
6                                       
7     ServiceSearch         TA     95AKSJAPI     

Expected output:

          Type          Channel       Agt                      
0     ServiceList          DCS                         
1     ServiceList          WEB          
2     ServiceSearch        TA      95AKSJAPI   

I tried using

df.dropna(inplace=True)

I am getting output as

           Type        Channel       Agt                     
0     ServiceSearch      TA     95AKSJAPI 
Asked By: Rejoy

||

Answers:

You can do:

df[~df.eq('').all(1)]

if you have NaN instead of empty strings, then yes you can do as Remmelzwaal mentioned in the comment or df[~df.isna().all(1)]

Output:

            Type Channel        Agt
1    ServiceList     DCS           
4    ServiceList     WEB           
7  ServiceSearch      TA  95AKSJAPI
Answered By: SomeDude
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.