class_docstr: Accessor object for structured data properties of the Series values.
  
  Parameters
  ----------
  data : Series
      Series containing Arrow struct data.
docstr: Extract a child field of a struct as a Series.
  
  Parameters
  ----------
  name_or_index : str | bytes | int | expression | list
      Name or index of the child field to extract.
  
      For list-like inputs, this will index into a nested
      struct.
  
  Returns
  -------
  pandas.Series
      The data corresponding to the selected child field.
  
  See Also
  --------
  Series.struct.explode : Return all child fields as a DataFrame.
  
  Notes
  -----
  The name of the resulting Series will be set using the following
  rules:
  
  - For string, bytes, or integer `name_or_index` (or a list of these, for
    a nested selection), the Series name is set to the selected
    field's name.
  - For a :class:`pyarrow.compute.Expression`, this is set to
    the string form of the expression.
  - For list-like `name_or_index`, the name will be set to the
    name of the final field selected.
  
  Examples
  --------
  >>> import pyarrow as pa
  >>> s = pd.Series(
  ...     [
  ...         {"version": 1, "project": "pandas"},
  ...         {"version": 2, "project": "pandas"},
  ...         {"version": 1, "project": "numpy"},
  ...     ],
  ...     dtype=pd.ArrowDtype(pa.struct(
  ...         [("version", pa.int64()), ("project", pa.string())]
  ...     ))
  ... )
  
  Extract by field name.
  
  >>> s.struct.field("project")
  0    pandas
  1    pandas
  2     numpy
  Name: project, dtype: string[pyarrow]
  
  Extract by field index.
  
  >>> s.struct.field(0)
  0    1
  1    2
  2    1
  Name: version, dtype: int64[pyarrow]
  
  Or an expression
  
  >>> import pyarrow.compute as pc
  >>> s.struct.field(pc.field("project"))
  0    pandas
  1    pandas
  2     numpy
  Name: project, dtype: string[pyarrow]
  
  For nested struct types, you can pass a list of values to index
  multiple levels:
  
  >>> version_type = pa.struct([
  ...     ("major", pa.int64()),
  ...     ("minor", pa.int64()),
  ... ])
  >>> s = pd.Series(
  ...     [
  ...         {"version": {"major": 1, "minor": 5}, "project": "pandas"},
  ...         {"version": {"major": 2, "minor": 1}, "project": "pandas"},
  ...         {"version": {"major": 1, "minor": 26}, "project": "numpy"},
  ...     ],
  ...     dtype=pd.ArrowDtype(pa.struct(
  ...         [("version", version_type), ("project", pa.string())]
  ...     ))
  ... )
  >>> s.struct.field(["version", "minor"])
  0     5
  1     1
  2    26
  Name: minor, dtype: int64[pyarrow]
  >>> s.struct.field([0, 0])
  0    1
  1    2
  2    1
  Name: major, dtype: int64[pyarrow]
docstr_tok: ["Extract","a","child","field","of","a","struct","as","a","Series",".","Parameters","--","--","--","--","--","name_or_index",":","str","|","bytes","|","int","|","expression","|","list","Name","or","index","of","the","child","field","to","extract",".","For","list-like","inputs",",","this","will","index","into","a","nested","struct",".","Returns","--","--","--","-","pandas.Series","The","data","corresponding","to","the","selected","child","field",".","See","Also","--","--","--","--","Series.struct.explode",":","Return","all","child","fields","as","a","DataFrame",".","Notes","--","--","-","The","name","of","the","resulting","Series","will","be","set","using","the","following","rules",":","-","For","string",",","bytes",",","or","integer","`","name_or_index","`","(","or","a","list","of","these",",","for","a","nested","selection",")",",","the","Series","name","is","set","to","the","selected","field","'s","name",".","-","For","a",":","class",":","`","pyarrow.compute.Expression","`",",","this","is","set","to","the","string","form","of","the","expression",".","-","For","list-like","`","name_or_index","`",",","the","name","will","be","set","to","the","name","of","the","final","field","selected",".","Examples","--","--","--","--",">",">",">","import","pyarrow","as","pa",">",">",">","s","=","pd.Series","(","...","[","...","{","``","version","''",":","1",",","``","project","''",":","``","pandas","''","}",",","...","{","``","version","''",":","2",",","``","project","''",":","``","pandas","''","}",",","...","{","``","version","''",":","1",",","``","project","''",":","``","numpy","''","}",",","...","]",",","...","dtype=pd.ArrowDtype","(","pa.struct","(","...","[","(","``","version","''",",","pa.int64","(",")",")",",","(","``","project","''",",","pa.string","(",")",")","]","...",")",")","...",")","Extract","by","field","name",".",">",">",">","s.struct.field","(","``","project","''",")","0","pandas","1","pandas","2","numpy","Name",":","project",",","dtype",":","string","[","pyarrow","]","Extract","by","field","index",".",">",">",">","s.struct.field","(","0",")","0","1","1","2","2","1","Name",":","version",",","dtype",":","int64","[","pyarrow","]","Or","an","expression",">",">",">","import","pyarrow.compute","as","pc",">",">",">","s.struct.field","(","pc.field","(","``","project","''",")",")","0","pandas","1","pandas","2","numpy","Name",":","project",",","dtype",":","string","[","pyarrow","]","For","nested","struct","types",",","you","can","pass","a","list","of","values","to","index","multiple","levels",":",">",">",">","version_type","=","pa.struct","(","[","...","(","``","major","''",",","pa.int64","(",")",")",",","...","(","``","minor","''",",","pa.int64","(",")",")",",","...","]",")",">",">",">","s","=","pd.Series","(","...","[","...","{","``","version","''",":","{","``","major","''",":","1",",","``","minor","''",":","5","}",",","``","project","''",":","``","pandas","''","}",",","...","{","``","version","''",":","{","``","major","''",":","2",",","``","minor","''",":","1","}",",","``","project","''",":","``","pandas","''","}",",","...","{","``","version","''",":","{","``","major","''",":","1",",","``","minor","''",":","26","}",",","``","project","''",":","``","numpy","''","}",",","...","]",",","...","dtype=pd.ArrowDtype","(","pa.struct","(","...","[","(","``","version","''",",","version_type",")",",","(","``","project","''",",","pa.string","(",")",")","]","...",")",")","...",")",">",">",">","s.struct.field","(","[","``","version","''",",","``","minor","''","]",")","0","5","1","1","2","26","Name",":","minor",",","dtype",":","int64","[","pyarrow","]",">",">",">","s.struct.field","(","[","0",",","0","]",")","0","1","1","2","2","1","Name",":","major",",","dtype",":","int64","[","pyarrow","]"]
code: def field(
      self,
      name_or_index: list[str]
      | list[bytes]
      | list[int]
      | pc.Expression
      | bytes
      | str
      | int,
  ) -> Series:
      """
      Extract a child field of a struct as a Series.
  
      Parameters
      ----------
      name_or_index : str | bytes | int | expression | list
          Name or index of the child field to extract.
  
          For list-like inputs, this will index into a nested
          struct.
  
      Returns
      -------
      pandas.Series
          The data corresponding to the selected child field.
  
      See Also
      --------
      Series.struct.explode : Return all child fields as a DataFrame.
  
      Notes
      -----
      The name of the resulting Series will be set using the following
      rules:
  
      - For string, bytes, or integer `name_or_index` (or a list of these, for
        a nested selection), the Series name is set to the selected
        field's name.
      - For a :class:`pyarrow.compute.Expression`, this is set to
        the string form of the expression.
      - For list-like `name_or_index`, the name will be set to the
        name of the final field selected.
  
      Examples
      --------
      >>> import pyarrow as pa
      >>> s = pd.Series(
      ...     [
      ...         {"version": 1, "project": "pandas"},
      ...         {"version": 2, "project": "pandas"},
      ...         {"version": 1, "project": "numpy"},
      ...     ],
      ...     dtype=pd.ArrowDtype(pa.struct(
      ...         [("version", pa.int64()), ("project", pa.string())]
      ...     ))
      ... )
  
      Extract by field name.
  
      >>> s.struct.field("project")
      0    pandas
      1    pandas
      2     numpy
      Name: project, dtype: string[pyarrow]
  
      Extract by field index.
  
      >>> s.struct.field(0)
      0    1
      1    2
      2    1
      Name: version, dtype: int64[pyarrow]
  
      Or an expression
  
      >>> import pyarrow.compute as pc
      >>> s.struct.field(pc.field("project"))
      0    pandas
      1    pandas
      2     numpy
      Name: project, dtype: string[pyarrow]
  
      For nested struct types, you can pass a list of values to index
      multiple levels:
  
      >>> version_type = pa.struct([
      ...     ("major", pa.int64()),
      ...     ("minor", pa.int64()),
      ... ])
      >>> s = pd.Series(
      ...     [
      ...         {"version": {"major": 1, "minor": 5}, "project": "pandas"},
      ...         {"version": {"major": 2, "minor": 1}, "project": "pandas"},
      ...         {"version": {"major": 1, "minor": 26}, "project": "numpy"},
      ...     ],
      ...     dtype=pd.ArrowDtype(pa.struct(
      ...         [("version", version_type), ("project", pa.string())]
      ...     ))
      ... )
      >>> s.struct.field(["version", "minor"])
      0     5
      1     1
      2    26
      Name: minor, dtype: int64[pyarrow]
      >>> s.struct.field([0, 0])
      0    1
      1    2
      2    1
      Name: major, dtype: int64[pyarrow]
      """
      from pandas import Series
  
      def get_name(
          level_name_or_index: list[str]
          | list[bytes]
          | list[int]
          | pc.Expression
          | bytes
          | str
          | int,
          data: pa.ChunkedArray,
      ):
          if isinstance(level_name_or_index, int):
              name = data.type.field(level_name_or_index).name
          elif isinstance(level_name_or_index, (str, bytes)):
              name = level_name_or_index
          elif isinstance(level_name_or_index, pc.Expression):
              name = str(level_name_or_index)
          elif is_list_like(level_name_or_index):
              # For nested input like [2, 1, 2]
              # iteratively get the struct and field name. The last
              # one is used for the name of the index.
              level_name_or_index = list(reversed(level_name_or_index))
              selected = data
              while level_name_or_index:
                  # we need the cast, otherwise mypy complains about
                  # getting ints, bytes, or str here, which isn't possible.
                  level_name_or_index = cast(list, level_name_or_index)
                  name_or_index = level_name_or_index.pop()
                  name = get_name(name_or_index, selected)
                  selected = selected.type.field(
                      selected.type.get_field_index(name)
                  )
                  name = selected.name
          else:
              raise ValueError(
                  "name_or_index must be an int, str, bytes, "
                  "pyarrow.compute.Expression, or list of those"
              )
          return name
  
      pa_arr = self._data.array._pa_array
      name = get_name(name_or_index, pa_arr)
      field_arr = pc.struct_field(pa_arr, name_or_index)
  
      return Series(
          field_arr,
          dtype=ArrowDtype(field_arr.type),
          index=self._data.index,
          name=name,
      )
  
imports: from __future__ import annotations
  from abc import ABCMeta, abstractmethod
  from typing import TYPE_CHECKING, cast
  from pandas.compat import pa_version_under10p1, pa_version_under11p0
  from pandas.core.dtypes.common import is_list_like
label_desc: Use image node_id 4 for calling the StructAccessor obj's underlying member method code with example usage: obj.field(name_or_index) and returns: Series, name