GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — fix: empty record dtypes by yokomotod · Pull Request #2147 · googleapis/python-bigquery
This repository was archived by the owner on Mar 6, 2026. It is now read-only.
Conversation
|
| # Avoid "ValueError: need at least one array to concatenate" on | ||
| # older versions of pandas when converting empty RecordBatch to | ||
| # DataFrame. See: https://github.com/pandas-dev/pandas/issues/41241 |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
pandas-dev/pandas#41052 has released with pandas 1.3.0 (as mentioned in above issue: pandas-dev/pandas#41241 (comment))
So if we can increase minimum pandas version to 1.3.0, we don't need this workaround
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
We should really come up with a consistent policy across all Google packages:
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Indeed, moving to a monorepo might help make the dependencies more consistent, ideally we might want any overlapped dependencies among the handwritten BigQuery projects to be consistent.
But just for the purpose of this PR, I think it's reasonable to increase the minimum pandas version to 1.3.0, as long as it's not breaking anything.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| opentelemetry-instrumentation==0.20b0 | ||
| opentelemetry-sdk==1.1.0 | ||
| packaging==24.2.0 | ||
| pandas==1.1.4 |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I confirmed that pandas==1.2.5 reproduces
FAILED tests/unit/test_table.py::TestRowIterator::test_to_dataframe_w_bqstorage_no_streams - ValueError: need at least one array to concatenate
and pandas==1.3.0 can pass
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Thanks for updating the constraint file!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, but will wait for @chalmerlowe or @Linchin to approve.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| # Avoid "ValueError: need at least one array to concatenate" on | ||
| # older versions of pandas when converting empty RecordBatch to | ||
| # DataFrame. See: https://github.com/pandas-dev/pandas/issues/41241 |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
We should really come up with a consistent policy across all Google packages:
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| opentelemetry-instrumentation==0.20b0 | ||
| opentelemetry-sdk==1.1.0 | ||
| packaging==24.2.0 | ||
| pandas==1.1.4 |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Thanks for updating the constraint file!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I think we need to remove some liens in the unit test so coverage test can pass, could you fix it for us? Then we should be able to merge the PR |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Indeed, pandas>=1.3.0 must have |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
A different system test is failing, could you fix it too? Thanks |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| # Result is dependent upon which version of pandas is being used. | ||
| # Float64 was not introduced until pandas version 1.4. | ||
| if PANDAS_INSTALLED_VERSION >= "1.4": | ||
| assert df.dtypes["float64_col"].name == "Float64" | ||
| else: | ||
| assert df.dtypes["float64_col"].name == "string" |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Float64 is introduced in pandas 1.2.0, not 1.4. So we can drop this handling now (pandas >= 1.3.0)
nox > python -m pip freeze
.
.
.
pandas==1.3.0
.
.
.
if PANDAS_INSTALLED_VERSION >= "1.4":
assert df.dtypes["float64_col"].name == "Float64"
else:
> assert df.dtypes["float64_col"].name == "string"
E AssertionError: assert 'Float64' == 'string'
E
E - string
E + Float64
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@Linchin sorry to overlooking another error, I fixed it too. Can you try to run Ci test again ? I have trouble to run the system test on my local (maybe due to old numpy on apple silicon) but the tests should pass. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for your contribution!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
object dtype when empty query result
There was an error while loading. Please reload this page.