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

ENH: Rename internal DataFrame._append() #57936

Open
1 of 3 tasks
Dr-Irv opened this issue Mar 20, 2024 · 7 comments
Open
1 of 3 tasks

ENH: Rename internal DataFrame._append() #57936

Dr-Irv opened this issue Mar 20, 2024 · 7 comments
Labels
API Design Enhancement Needs Discussion Requires discussion from core team before further action

Comments

@Dr-Irv
Copy link
Contributor

Dr-Irv commented Mar 20, 2024

Feature Type

  • Adding new functionality to pandas

  • Changing existing functionality in pandas

  • Removing existing functionality in pandas

Problem Description

This comment on the python discussion is interesting:
https://discuss.python.org/t/name-suggestions-for-attributeerrors-and-possibly-nameerrors-should-not-include-names-with-single-leading-underscores/48588

Example code (from main):

>>> pd.DataFrame.append()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: type object 'DataFrame' has no attribute 'append'. Did you mean: '_append'?

What is happening is that the python interpreter is suggesting people use DataFrame._append() since we removed append()

Feature Description

I think if we renamed the internal _append() to something like _internal_append_do_not_use() then maybe the interpreter wouldn't do that suggestion.

Alternative Solutions

Bring back DataFrame.append() ???

Additional Context

No response

@Dr-Irv Dr-Irv added Enhancement Needs Triage Issue that has not been reviewed by a pandas team member labels Mar 20, 2024
@rhshadrach
Copy link
Member

rhshadrach commented Mar 20, 2024

Is the proposal to do this with all internal methods that are similar to removed external names? I'm pretty opposed here - I think we should be free to chose internal names however we see fit.

@Dr-Irv
Copy link
Contributor Author

Dr-Irv commented Mar 20, 2024

Is the proposal to do this with all internal methods that are similar to removed external names? I'm pretty opposed here - I think we should be free to chose internal names however we see fit.

No, but in this case, since we deprecated DataFrame.append(), we don't want people using DataFrame._append() as a workaround so we need to hide it better.

@lithomas1 lithomas1 added API Design Needs Discussion Requires discussion from core team before further action and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Mar 20, 2024
@asishm
Copy link
Contributor

asishm commented Mar 20, 2024

I'd me somewhat +1 - see this SO answer -https://stackoverflow.com/a/76449334/2214597
while it does have a disclaimer, it's still pretty heavily upvoted.

Nvm - this SO question is already mentioned in the Discourse thread

@mroeschke
Copy link
Member

I would definitely wait until python/cpython#116871 has a resolution upstream before preemptively acting here.

@jbrockmendel
Copy link
Member

Isn’t a fix in cpython going to take ages? I’d be fine with changing the name on our end

@rhshadrach
Copy link
Member

No opposition if this is a unique case, but I'd like to not play whack-a-mole with the CPython interpreter and our internal names. That seems like too much code churn to me.

@Dr-Irv
Copy link
Contributor Author

Dr-Irv commented Apr 25, 2024

No opposition if this is a unique case, but I'd like to not play whack-a-mole with the CPython interpreter and our internal names. That seems like too much code churn to me.

I think the issue here is that we used to have DataFrame.append(), and now CPython is suggesting DataFrame._append(), so people are using it. If we remove methods in the future, then we should be aware of the similarity of the removed name with any "private" methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Design Enhancement Needs Discussion Requires discussion from core team before further action
Projects
None yet
Development

No branches or pull requests

6 participants