googleapis / googleapis/google-cloud-python

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

オープン
#14,474 コメント 1 件 リアクション 0 件 担当者 1 名 @tswast に割り当て済み GitHub で見る
api: bigquery
主要言語
Python
スター
5.4k
フォーク
1.8k
平均マージ
3日 4時間
マージ済み PR(30日)
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 を短くまとめたダイジェスト。