Affine Analytics Interview Questions | Removing null value from a column

Question

Null value treatment

in progress 0
TheDataMonk 4 years 1 Answer 795 views Grand Master 0

Answer ( 1 )

  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

Leave an answer

Browse
Browse