Skip to content

Commit 0fd8d06

Browse files
committed
wip
1 parent 3222de1 commit 0fd8d06

File tree

4 files changed

+19
-11
lines changed

4 files changed

+19
-11
lines changed

doc/source/io.rst

+7-1
Original file line numberDiff line numberDiff line change
@@ -4657,7 +4657,13 @@ Google BigQuery
46574657
Starting in 0.20.0, pandas has split off Google BigQuery support into the
46584658
separate package ``pandas-gbq``. You can ``pip install pandas-gbq`` to get it.
46594659

4660-
Documentation is now hosted `here <https://pandas-gbq.readthedocs.io/>`__
4660+
The ``pandas-gbq`` package provides functionality to read/write from Google BigQuery.
4661+
4662+
pandas integrates with this external package. if ``pandas-gbq`` is installed, you can
4663+
use the pandas methods ``pd.read_gbq`` and ``DataFrame.to_gbq``, which will call the
4664+
respective functions from ``pandas-gbq``.
4665+
4666+
Full cocumentation can be found `here <https://pandas-gbq.readthedocs.io/>`__
46614667

46624668
.. _io.stata:
46634669

pandas/core/frame.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -945,8 +945,7 @@ def to_gbq(self, destination_table, project_id, chunksize=10000,
945945
def _f():
946946
from pandas.io.gbq import _try_import
947947
return _try_import().to_gbq.__doc__
948-
to_gbq = docstring_wrapper(
949-
to_gbq, _f, default='the pandas_gbq package is not installed')
948+
to_gbq = docstring_wrapper(to_gbq, _f)
950949

951950
@classmethod
952951
def from_records(cls, data, index=None, exclude=None, columns=None,

pandas/io/gbq.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,12 @@ def _try_import():
1111
except ImportError:
1212

1313
# give a nice error message
14-
raise ImportError("the pandas-gbq library is not installed\n"
15-
"you can install\n"
14+
raise ImportError("Load data from Google BigQuery\n"
15+
"\n"
16+
"the pandas-gbq package is not installed\n"
17+
"see the docs: https://pandas-gbq.readthedocs.io\n"
18+
"\n"
19+
"you can install via:\n"
1620
"pip install pandas-gbq\n")
1721

1822
return pandas_gbq
@@ -32,8 +36,7 @@ def read_gbq(query, project_id=None, index_col=None, col_order=None,
3236

3337

3438
read_gbq = docstring_wrapper(read_gbq,
35-
lambda: _try_import().read_gbq.__doc__,
36-
default='the pandas_gbq package is not installed')
39+
lambda: _try_import().read_gbq.__doc__)
3740

3841

3942
def to_gbq(dataframe, destination_table, project_id, chunksize=10000,
@@ -46,5 +49,4 @@ def to_gbq(dataframe, destination_table, project_id, chunksize=10000,
4649

4750

4851
to_gbq = docstring_wrapper(to_gbq,
49-
lambda: _try_import().to_gbq.__doc__,
50-
default='the pandas_gbq package is not installed')
52+
lambda: _try_import().to_gbq.__doc__)

pandas/util/decorators.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -266,5 +266,6 @@ def __call__(self, func, *args, **kwargs):
266266
def __doc__(self):
267267
try:
268268
return self.creator()
269-
except ImportError:
270-
return self.default
269+
except Exception as exc:
270+
msg = self.default or str(exc)
271+
return msg

0 commit comments

Comments
 (0)