class_docstr: Series.struct namespace.
class_docstr_tok: ["Series.struct","namespace","."]
code: def __getitem__(self, item: int | str) -> Series:
      if isinstance(item, int):
          return self.field(self.fields[item])
      elif isinstance(item, str):
          return self.field(item)
      else:
          raise TypeError(
              f"expected type 'int | str', got {type(item).__name__!r}"
          )
  
file_path: polars/py-polars/polars/series/struct.py
imports: from __future__ import annotations
  import os
  from collections import OrderedDict
  from typing import TYPE_CHECKING, Sequence
  from polars.series.utils import expr_dispatch
  from polars.utils._wrap import wrap_df
  from polars.utils.various import sphinx_accessor
label_desc: Use image node_id 2 for calling the StructNameSpace obj's underlying member method code with example usage: obj.__getitem__(item) and returns: self, self