Skip to content

Commit 8e403e4

Browse files
authored
DOC: Fixing EX01 - Added example (#54126)
* Working on to_gbq * Example to_gbq * Correcting to_gbq * Removed import * Removed #TODO lines * Removed doctest SKIP and merged w main
1 parent ee18e06 commit 8e403e4

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

ci/code_checks.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
131131
pandas.api.extensions.ExtensionArray.ndim \
132132
pandas.api.extensions.ExtensionArray.shape \
133133
pandas.api.extensions.ExtensionArray.tolist \
134-
pandas.DataFrame.to_gbq \
135134
pandas.DataFrame.__dataframe__
136135
RET=$(($RET + $?)) ; echo $MSG "DONE"
137136

pandas/core/frame.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2104,6 +2104,25 @@ def to_gbq(
21042104
--------
21052105
pandas_gbq.to_gbq : This function in the pandas-gbq library.
21062106
read_gbq : Read a DataFrame from Google BigQuery.
2107+
2108+
Examples
2109+
--------
2110+
Example taken from `Google BigQuery documentation
2111+
<https://cloud.google.com/bigquery/docs/samples/bigquery-pandas-gbq-to-gbq-simple>`_
2112+
2113+
>>> project_id = "my-project"
2114+
>>> table_id = 'my_dataset.my_table'
2115+
>>> df = pd.DataFrame({
2116+
... "my_string": ["a", "b", "c"],
2117+
... "my_int64": [1, 2, 3],
2118+
... "my_float64": [4.0, 5.0, 6.0],
2119+
... "my_bool1": [True, False, True],
2120+
... "my_bool2": [False, True, False],
2121+
... "my_dates": pd.date_range("now", periods=3),
2122+
... }
2123+
... )
2124+
2125+
>>> df.to_gbq(table_id, project_id=project_id) # doctest: +SKIP
21072126
"""
21082127
from pandas.io import gbq
21092128

0 commit comments

Comments
 (0)