googleapis / googleapis/google-cloud-python

Timestamp returns a different type depending on whether the data is empty or not.

未关闭
#14,474 1 条评论 0 个 reaction 已指派 1 人 已指派给 @tswast 在 GitHub 查看
api: bigquery
主要语言
Python
星标
5.4k
派生
1.8k
平均合并
3 天 4 小时
30 天内合并 PR
122

描述

#### Environment details

- OS type and version: macOS sonoma 14.6
- Python version: 3.11.9
- pip version: I use rye instead of pip. and rye version is 0.35
- `pandas-gbq` version: 0.26.1
- `pandas` version: 2.2.2

#### Code example

```python
import pandas_gbq

df = pandas_gbq.read_gbq('SELECT timestamp FROM `bigquery-public-data.pypi.file_downloads` LIMIT 1')
print(df.dtypes)

df = pandas_gbq.read_gbq('SELECT timestamp FROM `bigquery-public-data.pypi.file_downloads` LIMIT 0')
print(df.dtypes)
```

got the following. I expected either `us` or `ns`

```
timestamp datetime64[us, UTC]
dtype: object
timestamp datetime64[ns, UTC]
dtype: object
```

When I downgrade pandas version to 1.5.3, the above both code returns `datetime64[ns, UTC]`.

Thanks!

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。