googleapis / googleapis/google-cloud-python

add `index=True` option to `to_gbq`

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

描述

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

I'd like to be able to control when the DataFrame Index/MultiIndex is included in the serialized BigQuery table.

**Describe the solution you'd like**

I'd like a boolean parameter `index=True` to enable writing the index column(s) to the BigQuery table. For backwards compatibility, we might need to keep this parameter `False` by default.

**Describe alternatives you've considered**

Folks can always call `DataFrame.reset_index(drop=False)` before uploading if they want this behavior, but I do think it'd be nice to be consistent with other I/O methods.

**Additional context**

* https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.to_parquet.html (Has three options, where None is like True but serializes RangeIndex to metadata instead of as a column)
* https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.to_csv.html (index=True by default. Also includes an index_label="string-here" parameter to override the index name)

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

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