Missing Values
Missing Values: Finding Missing Values: NaN and isna, Dropping or Filling Missing Values.
Updated
- Finding Missing Values: NaN and isna (Apprentice): pandas marks a missing value as NaN, isna().sum() counts the missing values in every column, na_values in read_csv turns hidden blanks such as 'unknown' and '-' into NaN, and count and mean quietly leave missing values out.
- Dropping or Filling Missing Values (Apprentice): Once you know where a table's gaps are, dropna removes rows (all of them with any gap, or only those missing the columns you name in subset), fillna puts a value, a median or 'Unknown' in each gap, and a flag column records which values were filled so none is passed off as measured.