-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: Added example to MultiIndex doc string #17653
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
DOC: Added example to MultiIndex doc string #17653
Conversation
4692b39
to
b7bd41d
Compare
pandas/core/indexes/multi.py
Outdated
DataFrame, e.g.: | ||
|
||
>>> pd.Series([1, 2, 3, 4], index=mi) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually adding a See Also section would be good (as then links are generated)
pandas/core/indexes/multi.py
Outdated
>>> mi = MultiIndex.from_arrays(arrays, names=('number', 'color')) | ||
>>> mi | ||
|
||
Such a ``MultiIndex`` instance can be used as an index in a Series or |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this last part is not really relevant
you can certainly link to a MI (and Index) from Series / DataFrame constructor though
b7bd41d
to
0c36dc1
Compare
Codecov Report
@@ Coverage Diff @@
## master #17653 +/- ##
==========================================
- Coverage 91.26% 91.24% -0.02%
==========================================
Files 163 163
Lines 49776 49776
==========================================
- Hits 45426 45417 -9
- Misses 4350 4359 +9
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #17653 +/- ##
==========================================
- Coverage 91.26% 91.24% -0.02%
==========================================
Files 163 163
Lines 49806 49806
==========================================
- Hits 45455 45446 -9
- Misses 4351 4360 +9
Continue to review full report at Codecov.
|
fa1ecb6
to
eea2e7e
Compare
I've made changes. In addition, I've also added a |
pandas/core/indexes/multi.py
Outdated
|
||
Notes | ||
----- | ||
See the :ref:`user guide <advanced>` for more. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you have to put the full http link here (technically you don't for the built docs), but in a console this won't work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. done.
eea2e7e
to
26d8bd2
Compare
Hello @topper-123! Thanks for updating the PR. Cheers ! There are no PEP8 issues in this Pull Request. 🍻 Comment last updated on September 25, 2017 at 08:12 Hours UTC |
a788612
to
517f4b6
Compare
pandas/core/indexes/multi.py
Outdated
See the `user guide | ||
<http://pandas.pydata.org/pandas-docs/stable/advanced.html>`_ for more. | ||
|
||
See also |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See Also
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok
pandas/core/indexes/multi.py
Outdated
Examples | ||
--------- | ||
A new ``MultiIndex`` is typically constructed using one of the helper | ||
methods :attr:`MultiIndex.from_arrays``, :attr:`MultiIndex.from_product`` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be :meth:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, yes. Fixed.
517f4b6
to
eccb594
Compare
eccb594
to
a796a37
Compare
@topper-123 Thanks! It's really nice to see all those doc improvements! |
git diff upstream/master -u -- "*.py" | flake8 --diff
I think
MultiIndex
doc string should have a quick note on howMultiIndex
is typically instantiated, as you normally wouldn't instantiate it directly.I've added an example to the doc string, as in my experience
MultiIndex
is one of the more complex areas of Pandas, so a quick example is justified. This may be debatable, so if others disagree on having an example here, I can remove the example and just retain the links to the.from_*
methods.