Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
0343a64
adds to_dataframe() to QueryJob
alixhami Nov 7, 2017
b74e6d4
removes unnecessary system test
alixhami Nov 7, 2017
e89b8de
adds docstring to to_dataframe()
alixhami Nov 7, 2017
8184716
updates to _make_resource() after rebasing for #4355
alixhami Nov 7, 2017
bc20f91
skips to_dataframe() tests if pandas is not installed
alixhami Nov 7, 2017
2b8ca85
imports pandas at module level and raises exception in to_dataframe()…
alixhami Nov 10, 2017
5c52dc6
adds pandas as extra for installation
alixhami Nov 10, 2017
484ab91
updates docstring to google style
alixhami Nov 10, 2017
4db3f4b
adds pandas extra to nox environment
alixhami Nov 10, 2017
a31e79d
adds 'no cover' pragma for pandas import errors
alixhami Nov 10, 2017
03b7fd5
adds test for when pandas is None
alixhami Nov 13, 2017
0c7bf88
fixes lint error
alixhami Nov 13, 2017
84994a7
adds RowIterator class
alixhami Nov 14, 2017
04f76f5
moves to_dataframe() to RowIterator
alixhami Nov 14, 2017
4fd0cc0
adds test for pandas handling of basic BigQuery data types
alixhami Nov 15, 2017
321b56a
moves schema to RowIterator constructor
alixhami Nov 15, 2017
da52040
adds tests for column dtypes
alixhami Nov 17, 2017
83d9e3c
adds test for query results to_dataframe() with nested schema
alixhami Nov 17, 2017
10fcd7c
updates system test for to_dataframe to check types
alixhami Nov 17, 2017
6762f95
adds to_dataframe() helper to QueryJob
alixhami Nov 18, 2017
0802ca8
updates pandas version to latest version that passes unit tests
alixhami Nov 22, 2017
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
Prev Previous commit
Next Next commit
adds test for when pandas is None
  • Loading branch information
alixhami committed Nov 22, 2017
commit 03b7fd5d3af046d9e0e7fbd1d1302ee3ce6bf097
2 changes: 1 addition & 1 deletion bigquery/google/cloud/bigquery/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -1965,7 +1965,7 @@ def to_dataframe(self):
ValueError: If the `pandas` library cannot be imported.

"""
if pandas is None: # pragma: NO COVER
if pandas is None:
raise ValueError('The pandas library is not installed, please '
'install pandas to use the to_dataframe() '
'function.')
Expand Down
9 changes: 9 additions & 0 deletions bigquery/tests/unit/test_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -2786,6 +2786,15 @@ def test_to_dataframe_w_empty_results(self):
self.assertEqual(len(df), 0) # verify the number of rows
self.assertEqual(list(df), ['name', 'age']) # verify the column names

@mock.patch('google.cloud.bigquery.job.pandas', new=None)
def test_to_dataframe_error_if_pandas_is_none(self):
connection = _Connection({})
client = _make_client(project=self.PROJECT, connection=connection)
job = self._make_one(self.JOB_ID, self.QUERY, client)

with self.assertRaises(ValueError):
df = job.to_dataframe()

def test_iter(self):
import types

Expand Down