Skip to main content
`Ctrl`+`K`

# pandas.Categorical.dtype

property Categorical.dtype

  The `CategoricalDtype` for this instance.

  This property returns the CategoricalDtype which contains information about the categories and whether the categorical is ordered.

  See also

  `astype`

    Cast argument to a specified dtype.

  `CategoricalDtype`

    Type for categorical data.

  Examples

      >>> cat = pd.Categorical(["a", "b"], ordered=True)
      >>> cat
      ['a', 'b']
      Categories (2, str): ['a' < 'b']
      >>> cat.dtype
      CategoricalDtype(categories=['a', 'b'], ordered=True, categories_dtype=str)