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

expand on different Getitem uses #60806

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

afeld
Copy link
Member

@afeld afeld commented Jan 28, 2025

This is confusing to my students, so figured it would be helpful to call it out explicitly.

  • closes #xxxx (Replace xxxx with the GitHub issue number)
  • Tests added and passed if fixing a bug or adding a new feature
  • All code checks passed.
  • Added type annotations to new arguments/methods/functions.
  • Added an entry in the latest doc/source/whatsnew/vX.X.X.rst file if fixing a bug or adding a new feature.


.. ipython:: python

df["A"]

If the label only contains letters, numbers, and underscores, you can
alternatively use dot notation:
Copy link
Member Author

Choose a reason for hiding this comment

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

Is "dot notation" the right term?

Copy link
Member

Choose a reason for hiding this comment

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

Get attribute (getattr) notation would be more correct


.. ipython:: python

df["A"]

If the label only contains letters, numbers, and underscores, you can
Copy link
Member Author

Choose a reason for hiding this comment

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

Mind confirming I have this right?

Copy link
Member

Choose a reason for hiding this comment

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

pandas allows strings that pass isidentifier https://docs.python.org/3/library/stdtypes.html#str.isidentifier

@mroeschke mroeschke added the Docs label Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants