Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

BUG: Fix DataFrame constructor misclassification of array-like with 'name' attribute (#61443)#61451

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
mroeschke merged 3 commits intopandas-dev:mainfromiabhi4:fix-61443-df-constructor
May 19, 2025

Conversation

iabhi4
Copy link
Contributor

@iabhi4iabhi4 commentedMay 17, 2025
edited
Loading

BUG: Fix DataFrame constructor misclassification of array-like with 'name' attribute

Previously, any object with a.name attribute (like somevtkArray-like objects) was assumed to be aSeries orIndex, causing the DataFrame constructor to misinterpret the input and raise errors when passed valid 2D array-likes.

This fix ensures we only apply the named-Series/Index logic when the input isactually an instance ofABCSeries orABCIndex, and thename is notNone.

A new test was added to ensure array-like subclasses with.name are handled correctly.


…name' attributePreviously, any object with a .name attribute (like some vtkArray-like objects) was assumed to be a Series or Index, causing the constructor to misinterpret the input.This fix ensures we only apply the named-Index/Series logic when the input is actually an instance of ABCSeries or ABCIndex *and* has a non-None name.Closespandas-dev#61443.
@iabhi4
Copy link
ContributorAuthor

Note: One unrelated pre-commit check failed:

Check for strings with misplaced spaces.................................................................Failed- hook id: unwanted-patterns-strings-with-misplaced-whitespacepandas/_libs/tslibs/offsets.pyx:5112: String has a space at the beginning instead of the end of the previous string.pandas/_libs/tslibs/offsets.pyx:5126: String has a space at the beginning instead of the end of the previous string.

One of the flagged lines includes:

f" instead.",

This has a space at thestart of the string rather than the end of the previous one, which violates theunwanted-patterns-strings-with-misplaced-whitespace pre-commit rule.

Since this file wasn't touched in this PR and is unrelated to the fix, I’ve left it as-is. Let me know if you'd like me to patch it.

Copy link
Member

@rhshadrachrhshadrach left a comment
edited
Loading

Choose a reason for hiding this comment

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

Thanks for the PR! Can you add a line in the whatsnew for 3.0 under theOther section in bugfixes.

One unrelated pre-commit check failed

As this isn't happening on the CI, I don't think it's of concern.

@iabhi4iabhi4 requested a review fromrhshadrachMay 18, 2025 21:15
@iabhi4
Copy link
ContributorAuthor

Thanks for the PR! Can you add a line in the whatsnew for 3.0 under theOther section in bugfixes.

Thanks for the review@rhshadrach!
Added the whatsnew entry and the GH#61443 comment in the test

Copy link
Member

@rhshadrachrhshadrach left a comment

Choose a reason for hiding this comment

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

lgtm

@rhshadrachrhshadrach added Bug ConstructorsSeries/DataFrame/Index/pd.array Constructors labelsMay 19, 2025
@rhshadrachrhshadrach added this to the3.0 milestoneMay 19, 2025
@mroeschkemroeschke merged commitae8ea3e intopandas-dev:mainMay 19, 2025
51 of 52 checks passed
@mroeschke
Copy link
Member

Thanks@iabhi4

iabhi4 reacted with rocket emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@mroeschkemroeschkemroeschke approved these changes

@rhshadrachrhshadrachrhshadrach approved these changes

Assignees
No one assigned
Labels
BugConstructorsSeries/DataFrame/Index/pd.array Constructors
Projects
None yet
Milestone
3.0
Development

Successfully merging this pull request may close these issues.

BUG:DataFrame constructor not compatible with array-like classes that have a'name' attribute
3 participants
@iabhi4@mroeschke@rhshadrach

[8]ページ先頭

©2009-2025 Movatter.jp