Affine Analytics Interview Questions | Removing null value from a column
Question
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
It will take less than 1 minute to register for lifetime. Bonus Tip - We don't send OTP to your email id Make Sure to use your own email id for free books and giveaways
Answer ( 1 )
df = pandas.DataFrame({A:[1,2,NaN], B:[NaN,2,3] })
Let this be your dataframe….
To remove null values from a column you can use dropna function
df.dropna(axis =0) # This will remove all the rows which have null values
df.dropna(axis =1) # This will remove all the columns which have null values