Skip to content
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

[Python] Clean-up name / field_name handling in pandas compat #44962

Closed
jorisvandenbossche opened this issue Dec 8, 2024 · 1 comment
Closed
Assignees
Milestone

Comments

@jorisvandenbossche
Copy link
Member

jorisvandenbossche commented Dec 8, 2024

Small part of #44195 factored out into its own PR because this change is just a small refactor making #44195 easier to do, but in itself not changing any logic.

We currently both store name and field_name in the pandas metadata. field_name is guaranteed to be a string, and is always exactly the name used in the arrow schema. name can also be None if the original pandas DataFrame used None as the column label or if it was coming from an index level without name.

Right now we had several places where we used name but then checked for it being None. We can make it more consistently use field_name in the cases it needs the string version.

raulcd pushed a commit that referenced this issue Dec 11, 2024
…at (#44963)

### Rationale for this change

Small part of #44195 factored out into its own PR because this change is just a small refactor making #44195 easier to do, but in itself not changing any logic.

We currently both store `name` and `field_name` in the pandas metadata. `field_name` is guaranteed to be a string, and is always exactly the name used in the arrow schema. `name` can also be None if the original pandas DataFrame used None as the column label or if it was coming from an index level without name.

Right now we had several places where we used `name` but then checked for it being None. With this PR I made it more consistently use `field_name` in the cases it needs the string version, by more consistently passing through both names a field_names.

### Are these changes tested?

Existing tests should cover this

### Are there any user-facing changes?

No

* Issue: #44962
* GitHub Issue: #44962

Authored-by: Joris Van den Bossche <[email protected]>
Signed-off-by: Raúl Cumplido <[email protected]>
@raulcd raulcd added this to the 19.0.0 milestone Dec 11, 2024
@raulcd
Copy link
Member

raulcd commented Dec 11, 2024

Issue resolved by pull request 44963
#44963

@raulcd raulcd closed this as completed Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants