difference between drop and dropna in pandas data frame
what is the difference between drop and dropna in pandas data frame?
1 answers ( 0 marked as helpful)
Thank you for your question!
drop() method drops specific labels from a column or a row. For example, the code
data = raw_data.drop(['Model'], axis=1)
will remove the entire 'Model' column from the dataframe.
dropna() method, on the other hand, removes observations containing missing values. For example, the code
data_no_mv = data.dropna(axis=0)
drops all rows (i.e. observations) that contain missing values.
Hope this helps!