AttributeError when use_bqstorage_api=True on empty df #299
Labels
priority: p1
Important issue which blocks shipping the next release. Will be fixed prior to next release.
type: bug
Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
The following error is thrown when using pandas_gbq.read_gbq with use_bqstorage_api=True when the query returns no data.
(use_bqstorage_api=True)
File '/env/local/lib/python3.7/site-packages/pandas_gbq/gbq.py', line 1034, in read_gbq
progress_bar_type=progress_bar_type,
File '/env/local/lib/python3.7/site-packages/pandas_gbq/gbq.py', line 532, in run_query
progress_bar_type=progress_bar_type,
File '/env/local/lib/python3.7/site-packages/pandas_gbq/gbq.py', line 576, in _download_results
df = _localize_df(schema_fields, df)
File '/env/local/lib/python3.7/site-packages/pandas_gbq/gbq.py', line 808, in _localize_df
if field['type'].upper() == 'TIMESTAMP' and df[column].dt.tz is None:
File '/env/local/lib/python3.7/site-packages/pandas/core/generic.py', line 5175, in getattr
return object.getattribute(self, name)
File '/env/local/lib/python3.7/site-packages/pandas/core/accessor.py', line 175, in get
accessor_obj = self._accessor(obj)
File '/env/local/lib/python3.7/site-packages/pandas/core/indexes/accessors.py', line 343, in new
raise AttributeError('Can only use .dt accessor with datetimelike ' 'values')
AttributeError: Can only use .dt accessor with datetimelike values
The text was updated successfully, but these errors were encountered: