Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove to_pandas_dtypes_overrides dead code #404

Merged
merged 17 commits into from
Mar 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions bigframes/dtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import typing
from typing import Any, Dict, Iterable, Literal, Tuple, Union

import bigframes_vendored.google_cloud_bigquery._pandas_helpers as gcb3p_pandas_helpers
import bigframes_vendored.ibis.backends.bigquery.datatypes as third_party_ibis_bqtypes
import bigframes_vendored.ibis.expr.operations as vendored_ibis_ops
import geopandas as gpd # type: ignore
Expand Down Expand Up @@ -492,21 +491,6 @@ def cast_ibis_value(
)


def to_pandas_dtypes_overrides(schema: Iterable[bigquery.SchemaField]) -> Dict:
"""For each STRUCT field, make sure we specify the full type to use."""
# TODO(swast): Also override ARRAY fields.
dtypes = {}
for field in schema:
if field.field_type == "RECORD" and field.mode != "REPEATED":
# TODO(swast): We're using a private API here. Would likely be
# better if we called `to_arrow()` and converted to a pandas
# DataFrame ourselves from that.
dtypes[field.name] = pd.ArrowDtype(
gcb3p_pandas_helpers.bq_to_arrow_data_type(field)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this import is no longer used.

See lint error https://github.com/googleapis/python-bigquery-dataframes/actions/runs/8144793137

)
return dtypes


def is_dtype(scalar: typing.Any, dtype: Dtype) -> bool:
"""Captures whether a scalar can be losslessly represented by a dtype."""
if scalar is None:
Expand Down