def has_known_categories(x):
 x = getattr(x, '_meta', x)
 if isinstance(x, pd.Series):
  return (UNKNOWN_CATEGORIES not in x.cat.categories)
 elif isinstance(x, pd.CategoricalIndex):
  return (UNKNOWN_CATEGORIES not in x.categories)
 raise TypeError('Expected Series or CategoricalIndex')

def has_known_categories ( x ) : x = getattr ( x , '_meta' , x ) if isinstance ( x , pd . Series ) : return ( UNKNOWN_CATEGORIES not in x . cat . categories ) elif isinstance ( x , pd . CategoricalIndex ) : return ( UNKNOWN_CATEGORIES not in x . categories ) raise TypeError ( 'Expected Series or CategoricalIndex' )
returns whether the categories in x are known .