docs: def fill_categorical_na(df, nan_cat='NA'):
      """Fill categoricals with 'NA', possibly creating a new category,
      and fill other NaNa with blanks """
      for col in df.columns[df.isna().any()].tolist():
  
          if df[col].dtype.name != 'category':
              # If not categorical, fill with a blank, which creates and
              # empty cell in CSV.
              df[col] = df[col].fillna('')
          else:
  
              try:
                  df[col].cat.add_categories([nan_cat], inplace=True)
              except ValueError:
                  pass
  
              df[col] = df[col].fillna(nan_cat)
  
      return df