categorical pandas code example Example: treat NaN as a category g_without_nan = g.cat.add_categories("D").fillna("D")