Skip to content

chore: remove an unused parameter in _rows_to_dataframe #813

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

Merged
merged 2 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
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
7 changes: 2 additions & 5 deletions bigframes/core/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,9 +438,7 @@ def reorder_levels(self, ids: typing.Sequence[str]):

def _to_dataframe(self, result) -> pd.DataFrame:
"""Convert BigQuery data to pandas DataFrame with specific dtypes."""
dtypes = dict(zip(self.index_columns, self.index.dtypes))
dtypes.update(zip(self.value_columns, self.dtypes))
result_dataframe = self.session._rows_to_dataframe(result, dtypes)
result_dataframe = self.session._rows_to_dataframe(result)
# Runs strict validations to ensure internal type predictions and ibis are completely in sync
# Do not execute these validations outside of testing suite.
if "PYTEST_CURRENT_TEST" in os.environ:
Expand Down Expand Up @@ -2582,15 +2580,14 @@ def to_pandas(self, *, ordered: Optional[bool] = None) -> pd.Index:
)
# Project down to only the index column. So the query can be cached to visualize other data.
index_columns = list(self._block.index_columns)
dtypes = dict(zip(index_columns, self.dtypes))
expr = self._expr.select_columns(index_columns)
results, _ = self.session._execute(
expr,
ordered=ordered
if (ordered is not None)
else self.session._strictly_ordered,
)
df = expr.session._rows_to_dataframe(results, dtypes)
df = expr.session._rows_to_dataframe(results)
df = df.set_index(index_columns)
index = df.index
index.names = list(self._block._index_labels) # type:ignore
Expand Down
2 changes: 1 addition & 1 deletion bigframes/session/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2038,7 +2038,7 @@ def _get_table_size(self, destination_table):
return table.num_bytes

def _rows_to_dataframe(
self, row_iterator: bigquery.table.RowIterator, dtypes: Dict
self, row_iterator: bigquery.table.RowIterator
) -> pandas.DataFrame:
# Can ignore inferred datatype until dtype emulation breaks 1:1 mapping between BQ types and bigframes types
dtypes_from_bq = bigframes.dtypes.bf_type_from_type_kind(row_iterator.schema)
Expand Down