def dtype_to_bigquery_field(name, dtype) -> Optional[schema.SchemaField]:
    """Infers the BigQuery schema field type from a pandas dtype.

    Args:
        name (str):
            Name of the column/field.
        dtype:
            A pandas / numpy dtype object.

    Returns:
        Optional[schema.SchemaField]:
            The schema field, or None if a type cannot be inferred, such as if
            it is ambiguous like the object dtype.
    """
    bq_type = _PANDAS_DTYPE_TO_BQ.get(dtype.name)

    if bq_type is not None:
        return schema.SchemaField(name, bq_type)

    if hasattr(pandas, "ArrowDtype") and isinstance(dtype, pandas.ArrowDtype):
        return pandas_gbq.schema.pyarrow_to_bigquery.arrow_type_to_bigquery_field(
            name, dtype.pyarrow_dtype
        )

    return None
Infers the BigQuery schema field type from a pandas dtype.

    Args:
        name (str):
            Name of the column/field.
        dtype:
            A pandas / numpy dtype object.

    Returns:
        Optional[schema.SchemaField]:
            The schema field, or None if a type cannot be inferred, such as if
            it is ambiguous like the object dtype.
    
pandas_gbq/schema/pandas_to_bigquery.py