def values_to_bigquery_field(
    name: str, values: Any, default_type: str = "STRING"
) -> Optional[schema.SchemaField]:
    """Infers the BigQuery schema field type from a list of values.

    This function iterates through the given values to determine the
    corresponding schema field type.

    Args:
        name:
            The name of the field.
        values:
            An iterable of values to infer the type from. If all the values
            are None or the iterable is empty, the function returns None.
        default_type:
            The default field type to use if a specific type cannot be
            determined from the values. Defaults to "STRING".

    Returns:
        The schema field, or None if a type cannot be inferred.
    """
    value = pandas_gbq.core.pandas.first_valid(values)

    # All values came back as NULL, thus type not determinable by this method.
    # Return None so we can try other methods.
    if value is None:
        return None

    field = value_to_bigquery_field(name, value, default_type=default_type)
    if field:
        return field

    # Check plain ARRAY values here. Exclude mapping types to let STRUCT get
    # determined by pyarrow, which can examine more values to determine all
    # keys.
    if isinstance(value, collections.abc.Iterable) and not isinstance(
        value, collections.abc.Mapping
    ):
        # It could be that this value contains all None or is empty, so get the
        # first non-None value we can find.
        valid_item = pandas_gbq.core.pandas.first_array_valid(values)
        field = value_to_bigquery_field(name, valid_item, default_type=default_type)

        if field is not None:
            return schema.SchemaField(name, field.field_type, mode="REPEATED")

    return None
Infers the BigQuery schema field type from a list of values.

    This function iterates through the given values to determine the
    corresponding schema field type.

    Args:
        name:
            The name of the field.
        values:
            An iterable of values to infer the type from. If all the values
            are None or the iterable is empty, the function returns None.
        default_type:
            The default field type to use if a specific type cannot be
            determined from the values. Defaults to "STRING".

    Returns:
        The schema field, or None if a type cannot be inferred.
    
pandas_gbq/schema/pandas_to_bigquery.py