Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions ci/deps/actions-310.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ dependencies:
- odfpy>=1.4.1
- qtpy>=2.3.0
- openpyxl>=3.1.0
# Doesn't install well with pyarrow
# https://github.com/pandas-dev/pandas/issues/55525
# - pandas-gbq>=0.19.0
- psycopg2>=2.9.6
- pyarrow>=10.0.1
- pymysql>=1.0.2
Expand Down
3 changes: 0 additions & 3 deletions ci/deps/actions-311-downstream_compat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ dependencies:
- odfpy>=1.4.1
- qtpy>=2.3.0
- openpyxl>=3.1.0
# Doesn't install well with pyarrow
# https://github.com/pandas-dev/pandas/issues/55525
# - pandas-gbq>=0.19.0
- psycopg2>=2.9.6
- pyarrow>=10.0.1
- pymysql>=1.0.2
Expand Down
3 changes: 0 additions & 3 deletions ci/deps/actions-311.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ dependencies:
- odfpy>=1.4.1
- qtpy>=2.3.0
- openpyxl>=3.1.0
# Doesn't install well with pyarrow
# https://github.com/pandas-dev/pandas/issues/55525
# - pandas-gbq>=0.19.0
- psycopg2>=2.9.6
- pyarrow>=10.0.1
- pymysql>=1.0.2
Expand Down
1 change: 0 additions & 1 deletion ci/deps/actions-39-minimum_versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ dependencies:
- odfpy=1.4.1
- qtpy=2.3.0
- openpyxl=3.1.0
#- pandas-gbq=0.19.0
- psycopg2=2.9.6
- pyarrow=10.0.1
- pymysql=1.0.2
Expand Down
3 changes: 0 additions & 3 deletions ci/deps/actions-39.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ dependencies:
- odfpy>=1.4.1
- qtpy>=2.3.0
- openpyxl>=3.1.0
# Doesn't install well with pyarrow
# https://github.com/pandas-dev/pandas/issues/55525
# - pandas-gbq>=0.19.0
- psycopg2>=2.9.6
- pyarrow>=10.0.1
- pymysql>=1.0.2
Expand Down
3 changes: 0 additions & 3 deletions ci/deps/circle-310-arm64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ dependencies:
- odfpy>=1.4.1
- qtpy>=2.3.0
- openpyxl>=3.1.0
# Doesn't install well with pyarrow
# https://github.com/pandas-dev/pandas/issues/55525
# - pandas-gbq>=0.19.0
- psycopg2>=2.9.6
- pyarrow>=10.0.1
- pymysql>=1.0.2
Expand Down
1 change: 0 additions & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,6 @@
"dateutil": ("https://dateutil.readthedocs.io/en/latest/", None),
"matplotlib": ("https://matplotlib.org/stable/", None),
"numpy": ("https://numpy.org/doc/stable/", None),
"pandas-gbq": ("https://pandas-gbq.readthedocs.io/en/latest/", None),
"py": ("https://pylib.readthedocs.io/en/latest/", None),
"python": ("https://docs.python.org/3/", None),
"scipy": ("https://docs.scipy.org/doc/scipy/", None),
Expand Down
1 change: 1 addition & 0 deletions doc/source/whatsnew/v2.2.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ For example:
Other Deprecations
^^^^^^^^^^^^^^^^^^
- Changed :meth:`Timedelta.resolution_string` to return ``h``, ``min``, ``s``, ``ms``, ``us``, and ``ns`` instead of ``H``, ``T``, ``S``, ``L``, ``U``, and ``N``, for compatibility with respective deprecations in frequency aliases (:issue:`52536`)
- Deprecated :func:`read_gbq` and :meth:`DataFrame.to_gbq`. Use ``pandas_gbq.read_gbq`` and ``pandas_gbq.to_gbq`` instead https://pandas-gbq.readthedocs.io/en/latest/api.html (:issue:`55525`)
- Deprecated :meth:`Index.format`, use ``index.astype(str)`` or ``index.map(formatter)`` instead (:issue:`55413`)
- Deprecated allowing non-keyword arguments in :meth:`DataFrame.to_clipboard`. (:issue:`54229`)
- Deprecated allowing non-keyword arguments in :meth:`DataFrame.to_csv` except ``path_or_buf``. (:issue:`54229`)
Expand Down
2 changes: 2 additions & 0 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -2133,6 +2133,8 @@ def to_gbq(
"""
Write a DataFrame to a Google BigQuery table.

.. deprecated:: 2.2.0

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add a message telling users to use pandas-gbq directly instead.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i.e. pandas_gbq.read_gbq

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. Added

This function requires the `pandas-gbq package
<https://pandas-gbq.readthedocs.io>`__.

Expand Down
18 changes: 18 additions & 0 deletions pandas/io/gbq.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
TYPE_CHECKING,
Any,
)
import warnings

from pandas.compat._optional import import_optional_dependency
from pandas.util._exceptions import find_stack_level

if TYPE_CHECKING:
import google.auth
Expand Down Expand Up @@ -43,6 +45,8 @@ def read_gbq(
"""
Load data from Google BigQuery.

.. deprecated:: 2.2.0

This function requires the `pandas-gbq package
<https://pandas-gbq.readthedocs.io>`__.

Expand Down Expand Up @@ -178,6 +182,13 @@ def read_gbq(
... dialect="standard"
... ) # doctest: +SKIP
"""
warnings.warn(
"read_gbq is deprecated and will be removed in a future version. "
"Please use pandas_gbq.read_gbq instead: "
"https://pandas-gbq.readthedocs.io/en/latest/api.html#pandas_gbq.read_gbq",
FutureWarning,
stacklevel=find_stack_level(),
)
pandas_gbq = _try_import()

kwargs: dict[str, str | bool | int | None] = {}
Expand Down Expand Up @@ -219,6 +230,13 @@ def to_gbq(
progress_bar: bool = True,
credentials: google.auth.credentials.Credentials | None = None,
) -> None:
warnings.warn(
"to_gbq is deprecated and will be removed in a future version. "
"Please use pandas_gbq.to_gbq instead: "
"https://pandas-gbq.readthedocs.io/en/latest/api.html#pandas_gbq.to_gbq",
FutureWarning,
stacklevel=find_stack_level(),
)
pandas_gbq = _try_import()
pandas_gbq.to_gbq(
dataframe,
Expand Down
14 changes: 14 additions & 0 deletions pandas/tests/io/test_gbq.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import pandas as pd
import pandas._testing as tm


def test_read_gbq_deprecated():
with tm.assert_produces_warning(FutureWarning):
with tm.external_error_raised(Exception):
pd.read_gbq("fake")


def test_to_gbq_deprecated():
with tm.assert_produces_warning(FutureWarning):
with tm.external_error_raised(Exception):
pd.DataFrame(range(1)).to_gbq("fake")
5 changes: 0 additions & 5 deletions pandas/tests/test_downstream.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,6 @@ def test_seaborn():
seaborn.stripplot(x="day", y="total_bill", data=tips)


def test_pandas_gbq():
# Older versions import from non-public, non-existent pandas funcs
pytest.importorskip("pandas_gbq", minversion="0.10.0")


def test_pandas_datareader():
pytest.importorskip("pandas_datareader")

Expand Down
1 change: 0 additions & 1 deletion scripts/tests/data/deps_expected_random.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ dependencies:
- numexpr>=2.7.3
- openpyxl>=3.0.7
- odfpy>=1.4.1
- pandas-gbq>=0.15.0
- psycopg2>=2.8.6
- pyarrow<11, >=7.0.0
- pymysql>=1.0.2
Expand Down
3 changes: 1 addition & 2 deletions scripts/tests/data/deps_minimum.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ timezone = ['tzdata>=2022.1']
computation = ['scipy>=1.7.1', 'xarray>=0.21.0']
fss = ['fsspec>=2021.07.0']
aws = ['s3fs>=2021.08.0']
gcp = ['gcsfs>=2021.07.0', 'pandas-gbq>=0.15.0']
gcp = ['gcsfs>=2021.07.0']
excel = ['odfpy>=1.4.1', 'openpyxl>=3.0.7', 'python-calamine>=0.1.6', 'pyxlsb>=1.0.8', 'xlrd>=2.0.1', 'xlsxwriter>=1.4.3']
parquet = ['pyarrow>=7.0.0']
feather = ['pyarrow>=7.0.0']
Expand Down Expand Up @@ -94,7 +94,6 @@ all = ['beautifulsoup4>=5.9.3',
'numexpr>=2.7.3',
'odfpy>=1.4.1',
'openpyxl>=3.0.7',
'pandas-gbq>=0.15.0',
'psycopg2>=2.8.6',
'pyarrow>=7.0.0',
'pymysql>=1.0.2',
Expand Down
1 change: 0 additions & 1 deletion scripts/tests/data/deps_unmodified_random.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ dependencies:
- numexpr>=2.7.3
- openpyxl>=3.0.7
- odfpy>=1.4.1
- pandas-gbq>=0.15.0
- psycopg2
- pyarrow<11, >=7.0.0
- pymysql>=1.0.2
Expand Down