Skip to content

BUG: resolve divide by 0 error when uploading empty dataframe #252

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Feb 26, 2019
Prev Previous commit
Next Next commit
update empty df
  • Loading branch information
wb committed Feb 23, 2019
commit 87ae1259932c745c1c3dda3d45afb197c903dbb1
2 changes: 1 addition & 1 deletion tests/system/test_gbq.py
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ def test_upload_data(self, project_id):
def test_upload_empty_data(self, project_id):
test_id = "data_with_0_rows"
test_size = 0
df = pd.DataFrame()
df = DataFrame()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like we might have an additional problem when the DataFrame contains no columns.

In the conda build (https://circleci.com/gh/tswast/pandas-gbq/276) I'm getting:

E           google.api_core.exceptions.BadRequest: 400 POST https://www.googleapis.com/upload/bigquery/v2/projects/pandas-gbq-tests/jobs?uploadType=resumable: Empty schema specified for the load job. Please specify a schema that describes the data being loaded.

Since we still create a table in pandas-gbq before running the load job, we can probably avoid doing the load job altogether when a DataFrame contains no rows.


gbq.to_gbq(
df,
Expand Down