code: def convert_pandas_type_to_json_field(
      arr,
  ) -> dict[str, JSONSerializable]:
      dtype = arr.dtype
      name: JSONSerializable
      if arr.name is None:
          name = "values"
      else:
          name = arr.name
      field: dict[str, JSONSerializable] = {
          "name": name,
          "type": as_json_table_type(dtype),
      }
  
      if is_categorical_dtype(dtype):
          cats = dtype.categories
          ordered = dtype.ordered
  
          field["constraints"] = {"enum": list(cats)}
          field["ordered"] = ordered
      elif is_period_dtype(dtype):
          field["freq"] = dtype.freq.freqstr
      elif is_datetime64tz_dtype(dtype):
          if timezones.is_utc(dtype.tz):
              # timezone.utc has no "zone" attr
              field["tz"] = "UTC"
          else:
              field["tz"] = dtype.tz.zone
      elif is_extension_array_dtype(dtype):
          field["extDtype"] = dtype.name
      return field
  
file_path: catboost/contrib/python/pandas/py3/pandas/io/json/_table_schema.py
imports: from __future__ import annotations
  from typing import TYPE_CHECKING, Any, cast
  import warnings
  from pandas._libs.json import loads
  from pandas._libs.tslibs import timezones
  from pandas._typing import DtypeObj, JSONSerializable
  from pandas.util._exceptions import find_stack_level
  from pandas.core.dtypes.base import _registry
  from pandas.core.dtypes.common import is_bool_dtype, is_categorical_dtype, is_datetime64_dtype, is_datetime64tz_dtype, is_extension_array_dtype, is_integer_dtype, is_numeric_dtype, is_period_dtype, is_string_dtype, is_timedelta64_dtype
  from pandas.core.dtypes.dtypes import CategoricalDtype
  from pandas import DataFrame
  import pandas.core.common
label_desc: Use image node_id 3 for calling a global function with example usage: convert_pandas_type_to_json_field(arr) and returns: field