GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(bigquery): unit and system test for dataframe with int column with Nan values by HemangChothani · Pull Request #39 · googleapis/python-bigquery

This repository was archived by the owner on Mar 6, 2026. It is now read-only.

Conversation

@HemangChothani

@HemangChothani HemangChothani commented Feb 18, 2020

Copy link
Copy Markdown
Contributor

Fixes #22

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@HemangChothani
feat(bigquery): add unit and system tests for int columns
b620f85
@HemangChothani
HemangChothani requested review from plamut and tswast February 18, 2020 14:00
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Feb 18, 2020
@HemangChothani
feat(bigquery): cosmetic changes
b906717
@MaxxleLLC
MaxxleLLC force-pushed the bigquery_issue_22 branch from 12345bb to b906717 Compare February 18, 2020 14:06
@HemangChothani HemangChothani changed the title Bigquery issue 22 feat(bigquery): unit and system test for dataframe with int column with Nan values Feb 18, 2020
plamut
plamut reviewed Feb 19, 2020
View reviewed changes

@plamut plamut left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I think it's good, just have two suggestion on improving the skipIf decorators.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread tests/system.py Outdated

@unittest.skipIf(
pandas is None or pandas.__version__ < "1.0.1",
"Only `pandas version >=1.0.1` supports",

@plamut plamut Feb 19, 2020

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Suggested change
"Only `pandas version >=1.0.1` supports",
"Only `pandas version >=1.0.1` supported",

Seems like more correct? (disclaimer: not a native speaker)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread tests/system.py Outdated
self.assertEqual(table.num_rows, 3)

@unittest.skipIf(
pandas is None or pandas.__version__ < "1.0.1",

@plamut plamut Feb 19, 2020

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thought - I think comparing plain version strings will actually work in this particular case, but cannot be generalized (e.g. somebody copies this pattern over to another test, or if we have to change the version for some reason).

Let's instead add a library like packaging as a test dependency, and use that for parsing and semantically comparing versions?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@plamut plamut Feb 19, 2020

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

BTW, why pandas version 1.0.1+, as the code sample from the issue description also seems to works in pandas 1.0.0?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@HemangChothani HemangChothani Feb 20, 2020

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Agreed, but need suggestion on version comparison like should i use parse(pandas.__version__) < parse("1.0.0") or should i change the pandas required minimum version in setup.py file and skip that if PY2 or something else?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@plamut plamut Feb 20, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Since the issue was due to a bug in Pandas, it's probably best to directly compare the version of Pandas rather than a proxy value such as the Python version.

Re: bumping the version - if the new Pandas version is still compatible with Python 2.7, we can bump it (we have tests...), otherwise we will have to wait until April or so when we officially drop Python 2 support (IIRC).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@HemangChothani HemangChothani Feb 20, 2020

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

New version of pandas isn't compatible with Python 2.7, it Requires: Python >=3.6.1.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@plamut plamut Feb 20, 2020

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I see. We could still conditionally bump the pandas version for Python 3.5+ in setup.py, though, to at least guarantee correct behavior in Python 3, even though we cannot fix the bug in Python 2.7 due to pandas incompatibility.

@tswast What do you think?

P.S.: If there is an efficient way of detecting whether a column contains a NaN value, we could also emit a user warning if too old a pandas version is installed... just a thought.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@plamut plamut Feb 26, 2020

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

@tswast bump

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@tswast tswast Feb 26, 2020

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

We have setuptools as a required dependency, so why aren't you using pkg_resources?

https://github.com/pydata/pandas-gbq/blob/97e9a9ee3a8f65ede29f25954b1af3f3bc606f58/pandas_gbq/gbq.py#L46

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@tswast tswast Feb 26, 2020

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

A lot of places (including Google) are pretty slow to update pandas, so I'd hesitate to require 1.0+ just yet.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
tswast
tswast reviewed Feb 26, 2020
View reviewed changes
Comment thread tests/system.py Outdated
"Only `pandas version >=1.0.1` is supported",
)
@unittest.skipIf(pyarrow is None, "Requires `pyarrow`")
def test_load_table_from_dataframe_w_none_value(self):

@tswast tswast Feb 26, 2020

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

The nullable Int64 data type is the real reason for the test. There are plenty of existing tests & samples with loading None values object dtype.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
HemangChothani added 2 commits February 27, 2020 16:58
@HemangChothani
feat(bigquery): use pkg_resources for comparison
626cc8c
@HemangChothani
Merge remote-tracking branch 'upstream/master' into bigquery_issue_22
a1be872
plamut
plamut approved these changes Mar 4, 2020
View reviewed changes
@HemangChothani
HemangChothani requested a review from shollyman March 17, 2020 10:48
@plamut

plamut commented Apr 2, 2020

Copy link
Copy Markdown
Contributor

@shollyman Friendly ping. :)

@HemangChothani Please just bring the branch up to date in the meanwhile, thanks!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

HemangChothani added 2 commits April 2, 2020 19:21
@HemangChothani
Merge branch 'master' of https://github.com/googleapis/python-bigquery …
b3a9781
…into bigquery_issue_22
@HemangChothani
Merge branch 'master' of https://github.com/googleapis/python-bigquery …
a3547de
…into bigquery_issue_22
@HemangChothani

HemangChothani commented Apr 29, 2020

Copy link
Copy Markdown
Contributor Author

@shollyman PTAL!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

HemangChothani added 2 commits May 8, 2020 16:13
@HemangChothani
Merge branch 'master' of https://github.com/googleapis/python-bigquery …
62eb1ad
…into bigquery_issue_22
@HemangChothani
Merge branch 'master' of https://github.com/googleapis/python-bigquery …
db5fdc4
…into bigquery_issue_22
@HemangChothani

HemangChothani commented May 11, 2020

Copy link
Copy Markdown
Contributor Author

@shollyman Friendly ping. :)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

shollyman
shollyman approved these changes May 12, 2020
View reviewed changes
Comment thread tests/system.py Outdated
(TooManyRequests, InternalServerError, ServiceUnavailable)
)

PANDAS_MINIUM_VERSION = pkg_resources.parse_version("1.0.0")

@shollyman shollyman May 12, 2020

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

s/MINIUM/MINIMUM/ and all the references

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
HemangChothani added 4 commits May 12, 2020 17:18
@HemangChothani
feat(bigquery): nit
95ddeb8
@HemangChothani
Merge branch 'master' of https://github.com/googleapis/python-bigquery …
734f895
…into bigquery_issue_22
@HemangChothani
Merge branch 'master' of https://github.com/googleapis/python-bigquery …
d9cd2f1
…into bigquery_issue_22
@HemangChothani
Merge branch 'master' of https://github.com/googleapis/python-bigquery …
66cf1fe
…into bigquery_issue_22
@HemangChothani
HemangChothani merged commit 5fd840e into googleapis:master May 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

3 more reviewers
@tswast tswast tswast left review comments
@shollyman shollyman shollyman approved these changes
@plamut plamut plamut approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

BigQuery : ArrowTypeError when trying to push DataFrame with int columns with NaN values

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@HemangChothani @plamut @tswast @shollyman @googlebot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.