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 — Fix the conversion error for pandas.Series with missing values in pandas<=2.1 by seisman · Pull Request #3505 · GenericMappingTools/pygmt

Conversation

@seisman

@seisman seisman commented Oct 10, 2024 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

Description of proposed changes

See #2844 for the issue report.

It turns out that in pandas <= 2.1, pd.Series with integer values and pd.NA are converted to object type, which can't be recognized later, but in pandas >= 2.2, they are converted to float type.

In this PR, we add a workaround for pandas<=2.1 by casting the pd.Series to float type explicitly if it contains pd.NA.

Closes #2844.

As per SPEC 0 policy, support of pandas 2.1 should be dropped in 2025 Q3, so we expect to remove the workaround for PyGMT v0.17.0.

Sorry, something went wrong.

Uh oh!

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

All reactions
@seisman
Add workaround for pandas.NA support with pandas<=2.1
5d4bff5
@seisman
seisman force-pushed the pandas/NA branch from 3f1a736 to 5d4bff5 Compare October 10, 2024 16:49
seisman
seisman commented Oct 11, 2024
View reviewed changes
Comment thread pygmt/clib/conversion.py Resolved

Uh oh!

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

seisman added 2 commits October 11, 2024 09:56
@seisman
Remove a blank line
e110015
@seisman
Merge branch 'main' into pandas/NA
fd2bf10
@seisman seisman added bug Something isn't working needs review This PR has higher priority and needs review. labels Oct 11, 2024
@seisman seisman added this to the 0.14.0 milestone Oct 11, 2024
@seisman seisman changed the title POC: Add workaround for pandas.NA support with pandas<=2.1 Fix the conversion error for pandas.Series with missing values in pandas<=2.1 Oct 11, 2024
@seisman
seisman marked this pull request as ready for review October 11, 2024 01:58
@seisman
seisman requested a review from weiji14 October 11, 2024 02:15
weiji14
weiji14 approved these changes Oct 11, 2024
View reviewed changes
Comment thread pygmt/clib/conversion.py Resolved

Uh oh!

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

@seisman @weiji14
Fix a typo [skip ci]
aa5d839
Co-authored-by: Wei Ji <[email protected]>
@seisman seisman added final review call This PR requires final review and approval from a second reviewer and removed needs review This PR has higher priority and needs review. labels Oct 11, 2024
michaelgrund
michaelgrund approved these changes Oct 11, 2024
View reviewed changes
@seisman seisman removed the final review call This PR requires final review and approval from a second reviewer label Oct 11, 2024
@seisman
seisman merged commit 8e04d00 into main Oct 11, 2024
@seisman
seisman deleted the pandas/NA branch October 11, 2024 05:59
seisman added a commit that referenced this pull request Oct 16, 2024
@seisman @weiji14
Fix the conversion error for pandas.Series with missing values in pan…
3252988
…das<=2.1 (#3505)

Co-authored-by: Wei Ji <[email protected]>
This was referenced Nov 5, 2024
clib.converison._to_numpy: Add tests for pandas.Series with pandas numeric dtypes #3584
Merged
Improve the workarounds for handling pandas nullable dtypes in pandas<=2.1 #3596
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@michaelgrund michaelgrund michaelgrund approved these changes
@weiji14 weiji14 weiji14 approved these changes

Uh oh!

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

Assignees

No one assigned

Labels

bug Something isn't working

Projects

None yet

Milestone

0.14.0

Development

Successfully merging this pull request may close these issues.

Error when passing pd.NA value in a data column with pandas nullable int dtype

Uh oh!

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

3 participants

@seisman @michaelgrund @weiji14
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 01402792 — 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.