googleapis / googleapis/google-cloud-python

Support extended range of pd.Timestamp with pandas 2.0

未关闭
#15,661 3 条评论 0 个 reaction 已指派 1 人 已被 @ivansmf 认领 在 GitHub 查看
api: bigquery bigframes priority: p3 type: feature request
主要语言
Python
星标
5.4k
派生
1.8k
平均合并
3 天 4 小时
30 天内合并 PR
122

描述

**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

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

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