cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
cancel
Showing results for 
Search instead for 
Did you mean: 

how to remove empty rows from the data frame.

dhanunjaya
New Contributor II

lets assume if i have 10 columns in a data frame,all 10 columns has empty values for 100 rows out of 200 rows, how i can skip the empty rows?

6 REPLIES 6

dillon_bostwick
New Contributor II

dhanunjaya
New Contributor II

@dillon,

Drop will not help me in my case , i have a 200 rows in a table which has 100 rows as null and rest of rows has proper values .

searro
New Contributor II

Simply you can just use the .drop() function, which is available as part of DataFrameNaFunctions.

Malan_Francois_
New Contributor II

@searro , it would be nice to have a well-formed example.

bhuvanrjb
New Contributor II

How can we do this in Java.

I have a DataFrame with three columns, When all three values are null. Is there a way to delete that row in java?

GaryDiaz
New Contributor II

you can try this: df.na.drop(how = "all"), this will remove the row only if all the rows are null or NaN

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.