code: def _sequence_of_sequence_to_pydf(
      first_element: Sequence[Any] | np.ndarray[Any, Any],
      data: Sequence[Any],
      schema: SchemaDefinition | None,
      schema_overrides: SchemaDict | None,
      orient: Orientation | None,
      infer_schema_length: int | None,
  ) -> PyDataFrame:
      if orient is None:
          # note: limit type-checking to smaller data; larger values are much more
          # likely to indicate col orientation anyway, so minimise extra checks.
          if len(first_element) > 1000:
              orient = (
                  "col"
                  if schema and len(schema) == len(data)
                  else "row"
              )
          elif (
              schema is not None and len(schema) == len(data)
          ) or not schema:
              # check if element types in the first 'row' resolve to a single dtype.
              row_types = {
                  type(value)
                  for value in first_element
                  if value is not None
              }
              if int in row_types and float in row_types:
                  row_types.discard(int)
              orient = "col" if len(row_types) == 1 else "row"
          else:
              orient = "row"
  
      if orient == "row":
          column_names, schema_overrides = _unpack_schema(
              schema,
              schema_overrides=schema_overrides,
              n_expected=len(first_element),
          )
          local_schema_override = (
              include_unknowns(schema_overrides, column_names)
              if schema_overrides
              else {}
          )
          if (
              column_names
              and len(first_element) > 0
              and len(first_element) != len(column_names)
          ):
              raise ShapeError(
                  "the row data does not match the number of columns"
              )
  
          unpack_nested = False
          for col, tp in local_schema_override.items():
              if tp in (Categorical, Enum):
                  local_schema_override[col] = String
              elif not unpack_nested and (
                  tp.base_type() in (Unknown, Struct)
              ):
                  unpack_nested = contains_nested(
                      getattr(first_element, col, None).__class__,
                      is_namedtuple,
                  )
  
          if unpack_nested:
              dicts = [nt_unpack(d) for d in data]
              pydf = PyDataFrame.read_dicts(dicts, infer_schema_length)
          else:
              pydf = PyDataFrame.read_rows(
                  data,
                  infer_schema_length,
                  local_schema_override or None,
              )
          if column_names or schema_overrides:
              pydf = _post_apply_columns(
                  pydf, column_names, schema_overrides=schema_overrides
              )
          return pydf
  
      if orient == "col" or orient is None:
          column_names, schema_overrides = _unpack_schema(
              schema,
              schema_overrides=schema_overrides,
              n_expected=len(data),
          )
          data_series: list[PySeries] = [
              pl.Series(
                  column_names[i],
                  element,
                  schema_overrides.get(column_names[i]),
              )._s
              for i, element in enumerate(data)
          ]
          return PyDataFrame(data_series)
  
      raise ValueError(
          f"`orient` must be one of {{'col', 'row', None}}, got {orient!r}"
      )
  
imports: from __future__ import annotations
  import contextlib
  import warnings
  from datetime import date, datetime, time, timedelta
  from decimal import Decimal
  from functools import lru_cache, singledispatch
  from itertools import islice, zip_longest
  from operator import itemgetter
  from sys import version_info
  from typing import TYPE_CHECKING, Any, Callable, Generator, Iterable, Iterator, Mapping, MutableMapping, Sequence, get_type_hints
  import polars._reexport
  from polars import functions
  from polars.datatypes import INTEGER_DTYPES, N_INFER_DEFAULT, TEMPORAL_DTYPES, Boolean, Categorical, Date, Datetime, Duration, Enum, List, Null, Object, String, Struct, Time, UInt32, Unknown, dtype_to_py_type, is_polars_dtype, numpy_char_code_to_dtype, py_type_to_dtype
  from polars.datatypes.constructor import numpy_type_to_constructor, numpy_values_and_dtype, polars_type_to_constructor, py_type_to_constructor
  from polars.dependencies import _NUMPY_AVAILABLE, _check_for_numpy, _check_for_pandas, _check_for_pydantic, dataclasses, pydantic
  from polars.dependencies import numpy
  from polars.dependencies import pandas
  from polars.dependencies import pyarrow
  from polars.exceptions import ComputeError, ShapeError, TimeZoneAwareConstructorWarning
  from polars.utils._wrap import wrap_df, wrap_s
  from polars.utils.meta import get_index_type, threadpool_size
  from polars.utils.various import _is_generator, arrlen, find_stacklevel, parse_version, range_to_series
label_desc: Use image node_id 27 for calling a global function with example usage: _sequence_of_sequence_to_pydf(first_element, data, schema, schema_overrides, orient, infer_schema_length) and returns: pydf, PyDataFrame