code: def pandas_Categorical_from_codes(codes, categories):
      assert have_pandas_categorical
  
      # Old versions of pandas sometimes fail to coerce this to an array and
      # just return it directly from .labels (?!).
      codes = np.asarray(codes)
      if hasattr(pandas.Categorical, "from_codes"):
          return pandas.Categorical.from_codes(codes, categories)
      else:
          return pandas.Categorical(codes, categories)
  
imports: import sys
  import numpy
  import six
  from six.moves import cStringIO
  from .compat import optional_dep_ok
label_desc: Use image node_id 23 for calling a global function with example usage: pandas_Categorical_from_codes(codes, categories) and returns: pandas, pandas