Skip to content

DOC: add documentation to IndexSlice #15623

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
Mar 9, 2017

Conversation

jdcla
Copy link
Contributor

@jdcla jdcla commented Mar 8, 2017

@jreback jreback added the Docs label Mar 8, 2017
@jreback jreback added this to the 0.20.0 milestone Mar 8, 2017
@jorisvandenbossche jorisvandenbossche changed the title Add documentation to IndexSlice DOC: add documentation to IndexSlice Mar 8, 2017
@jreback jreback added the Indexing Related to indexing on series/frames, not to indexes themselves label Mar 8, 2017
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.

Nice docstring!

You have a few PEP8 / style related issues. We test for this on travis (the third failing build has the output of those tests):

pandas/core/indexing.py:52:80: E501 line too long (81 > 79 characters)
pandas/core/indexing.py:59:51: W291 trailing whitespace
pandas/core/indexing.py:76:1: W293 blank line contains whitespace

But it is best that you configure your editor to automatically remove trailing whitespace on save (to prevent that you have to fix this manually). And you can always check this locally with git diff master | flake8 --diff
(if you have flake8 installed, see http://pandas.pydata.org/pandas-docs/stable/contributing.html#code-standards)

Examples
--------

>>> miindex = pd.MultiIndex.from_product([['A0','A1'],['B0','B1','B2','B3']])
Copy link
Member

Choose a reason for hiding this comment

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

This line is too long. But you can rename the miindex to eg midx, then it should fit :-)

Using the IndexSlice class for a more intuitive command:

>>> idx = pd.IndexSlice
>>> dfmi.loc[idx[:,['B0','B1']],:]
Copy link
Member

Choose a reason for hiding this comment

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

To be fully equivalent to the one above, the ['B0','B1'] should be 'B0':'B1' I think

@codecov-io
Copy link

codecov-io commented Mar 9, 2017

Codecov Report

Merging #15623 into master will decrease coverage by -0.02%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master   #15623      +/-   ##
==========================================
- Coverage   91.01%      91%   -0.02%     
==========================================
  Files         143      143              
  Lines       49301    49301              
==========================================
- Hits        44873    44864       -9     
- Misses       4428     4437       +9
Impacted Files Coverage Δ
pandas/core/indexing.py 94.21% <ø> (ø)
pandas/io/gbq.py 25% <0%> (-58.34%)
pandas/tools/merge.py 91.76% <0%> (-0.35%)
pandas/core/frame.py 97.87% <0%> (-0.1%)
pandas/tseries/index.py 95.39% <0%> (+0.09%)
pandas/core/common.py 91.3% <0%> (+0.33%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 54e71a7...7a318d0. Read the comment docs.

@jorisvandenbossche
Copy link
Member

OK, travis is happy now with regard to PEP8, merging then.

@jimclauwaert Thanks!

@jorisvandenbossche jorisvandenbossche merged commit 27b0ba7 into pandas-dev:master Mar 9, 2017
AnkurDedania pushed a commit to AnkurDedania/pandas that referenced this pull request Mar 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs Indexing Related to indexing on series/frames, not to indexes themselves
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DOC: add IndexSlice docstring + add to api docs
4 participants