googleapis / googleapis/google-cloud-python

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

Đang mở
#14,474 1 bình luận 0 reaction 1 người được giao Được giao cho @tswast Xem trên GitHub
api: bigquery
Ngôn ngữ chính
Python
Star
5.4k
Fork
1.8k
Merge trung bình
3 ngày 4 giờ
Pull request đã merge (30 ngày)
122

Mô tả

#### 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!

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.