googleapis / googleapis/google-cloud-python

Support extended range of pd.Timestamp with pandas 2.0

Đang mở
#15,661 3 bình luận 0 reaction 1 người được giao Được @ivansmf nhận Xem trên GitHub
api: bigquery bigframes priority: p3 type: feature request
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ả

**Is your feature request related to a problem? Please describe.**

When querying TIMESTAMP column, with pandas > 2.0 installed, the dtype is 'datetime64[us, UTC]`.
This is using the same precision as bigquery, which is what we want.

However if I query a TIMESTAMP column that contains data that is out of bounds for a 'datetime64[ns, UTC]` (but fit in a 'datetime64[us, UTC]`), the column dtype becomes `object`.

This is inefficient and also we lose meta data here.

**Describe the solution you'd like**

If pandas > 2.0, always return `datetime64[us, UTC]` for timestamp column

**Additional context**

The same thing happens for DATE and DATETIME and should be addressed as well.

This test captures the current behavior: https://github.com/googleapis/python-bigquery-pandas/blame/72f772ec7b36ba081ed18ef4409f8262a412a1b9/tests/system/test_read_gbq.py#L538

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.