Skip to content

DOC: Harmonize column selection to bracket notation #27562

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

Merged
merged 8 commits into from
Aug 26, 2019
Merged

DOC: Harmonize column selection to bracket notation #27562

merged 8 commits into from
Aug 26, 2019

Conversation

katrinleinweber
Copy link
Contributor

@katrinleinweber katrinleinweber commented Jul 24, 2019

As suggested by @tdpetrou. If there is agreement about not presenting the dot notation to access columns in the docu, please let me know and I'll then check the rest of the docu.

  • [~] closes #xxxx
  • [~] tests added / passed
  • [~] passes black pandas
  • [~] passes git diff upstream/master -u -- "*.py" | flake8 --diff
  • passes git diff upstream/master -u -- "*.rst" | flake8-rst --diff
  • [~] whatsnew entry

@katrinleinweber katrinleinweber changed the title Harmonize column selection to bracket notation DOC: Harmonize column selection to bracket notation Jul 24, 2019
@TomAugspurger
Copy link
Contributor

+1 to generally using getitem in the docs, other than the section describing dot access.

Can we think of a way to lint this, to ensure that we don’t regress on it in the future? I’m struggling to think of an easy way. A slightly harder way is to check for dot access of names that are in the columns with a python program run on the docs.

@WillAyd
Copy link
Member

WillAyd commented Jul 24, 2019

I'd be +1 for making this change comprehensively

@WillAyd WillAyd added the Docs label Jul 24, 2019
@katrinleinweber
Copy link
Contributor Author

katrinleinweber commented Jul 24, 2019

I will not be able to write python code to detect those occasions. Using df(.?)\.([A-D])(\W) for now and

  • checking the context.

Shall I also update old whatsnew/*.rst files?

@WillAyd
Copy link
Member

WillAyd commented Jul 25, 2019

I think ignore old whatsnews for now - we usually don't go back and change them

@katrinleinweber
Copy link
Contributor Author

OK, I hope I didn't overlook any of these changes' context to explicitly mention "dot" notation/access/attribute.

@WillAyd WillAyd added this to the 1.0 milestone Jul 26, 2019
@katrinleinweber
Copy link
Contributor Author

In order to add a whatsnew entry, shall I re-point this PR to branch 0.25.x? If yes, I would also add a Documentation section there, since I'm not sure into which of the pre-defined sections to put a summary of this change otherwise.

@katrinleinweber katrinleinweber marked this pull request as ready for review July 26, 2019 18:50
@WillAyd
Copy link
Member

WillAyd commented Jul 26, 2019

Don’t need a whatsnew for doc changes. Also can just point to master - We can back port to 0.25.1 if needed (though not sure we would for this)

@TomAugspurger
Copy link
Contributor

No need for back port.

@katrinleinweber
Copy link
Contributor Author

OK :-) Anything else to do here, then besides fixing those CI errors? Maybe a note recommending [ bracket ] notation (or summarising its advantages)?

The indexing operator ``[]`` provides a superset of the attribute operator ``.``,
such as the ability to index column names using a variable, or column names
that are the same as DataFrame methods, or contain spaces. Therefore, it is
recommended and presented here preferably.

@katrinleinweber
Copy link
Contributor Author

katrinleinweber commented Jul 27, 2019

I'll run the checks locally with flake8-rst doc/source/ --filename="*.rst" --format="default" to debug all these issues.

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

no objection to most of these changes, but some need to be reverted as indicated

Copy link
Member

@jorisvandenbossche jorisvandenbossche left a comment

Choose a reason for hiding this comment

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

Thanks! Some additional comments

katrinleinweber and others added 2 commits July 29, 2019 18:26
Co-Authored-By: Joris Van den Bossche <[email protected]>
Co-Authored-By: Joris Van den Bossche <[email protected]>
Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

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

lgtm

@TomAugspurger TomAugspurger merged commit a1bdacf into pandas-dev:master Aug 26, 2019
@TomAugspurger
Copy link
Contributor

Thanks @katrinleinweber!

@katrinleinweber
Copy link
Contributor Author

You're welcome! Thanks to you though, for agreeing with this & for merging :-)

proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
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.

5 participants