Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
jreback committed Feb 27, 2017
1 parent 3222de1 commit 0fd8d06
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
8 changes: 7 additions & 1 deletion doc/source/io.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4657,7 +4657,13 @@ Google BigQuery
Starting in 0.20.0, pandas has split off Google BigQuery support into the
separate package ``pandas-gbq``. You can ``pip install pandas-gbq`` to get it.

Documentation is now hosted `here <https://pandas-gbq.readthedocs.io/>`__
The ``pandas-gbq`` package provides functionality to read/write from Google BigQuery.

pandas integrates with this external package. if ``pandas-gbq`` is installed, you can
use the pandas methods ``pd.read_gbq`` and ``DataFrame.to_gbq``, which will call the
respective functions from ``pandas-gbq``.

Full cocumentation can be found `here <https://pandas-gbq.readthedocs.io/>`__

.. _io.stata:

Expand Down
3 changes: 1 addition & 2 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -945,8 +945,7 @@ def to_gbq(self, destination_table, project_id, chunksize=10000,
def _f():
from pandas.io.gbq import _try_import
return _try_import().to_gbq.__doc__
to_gbq = docstring_wrapper(
to_gbq, _f, default='the pandas_gbq package is not installed')
to_gbq = docstring_wrapper(to_gbq, _f)

@classmethod
def from_records(cls, data, index=None, exclude=None, columns=None,
Expand Down
14 changes: 8 additions & 6 deletions pandas/io/gbq.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ def _try_import():
except ImportError:

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

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


read_gbq = docstring_wrapper(read_gbq,
lambda: _try_import().read_gbq.__doc__,
default='the pandas_gbq package is not installed')
lambda: _try_import().read_gbq.__doc__)


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


to_gbq = docstring_wrapper(to_gbq,
lambda: _try_import().to_gbq.__doc__,
default='the pandas_gbq package is not installed')
lambda: _try_import().to_gbq.__doc__)
5 changes: 3 additions & 2 deletions pandas/util/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,5 +266,6 @@ def __call__(self, func, *args, **kwargs):
def __doc__(self):
try:
return self.creator()
except ImportError:
return self.default
except Exception as exc:
msg = self.default or str(exc)
return msg

0 comments on commit 0fd8d06

Please sign in to comment.