DOC: Add references for different index types + examples for pd.Index
State: closed

- [x ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`

Added 'See also'-references for different index types to make it easier to find the correct index type when in doubt  + added simple examples for pd.Index

Labels:
name: Docs

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=h1) Report
> Merging [#17680](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/0d239d9ec0a38d8208269fc688a49f0c3c6a9b2a?src=pr&el=desc) will **increase** coverage by `<.01%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/17680/graphs/tree.svg?height=150&width=650&src=pr&token=eZ4WkYLtcO)](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #17680      +/-   ##
==========================================
+ Coverage   91.23%   91.24%   +<.01%     
==========================================
  Files         163      163              
  Lines       49810    49810              
==========================================
+ Hits        45444    45447       +3     
+ Misses       4366     4363       -3
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.03% <ø> (+0.02%)` | :arrow_up: |
| #single | `40.32% <ø> (-0.07%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/indexes/range.py](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9yYW5nZS5weQ==) | `92.83% <ø> (ø)` | :arrow_up: |
| [pandas/core/indexes/base.py](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9iYXNlLnB5) | `96.29% <ø> (ø)` | :arrow_up: |
| [pandas/core/indexes/timedeltas.py](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy90aW1lZGVsdGFzLnB5) | `91.19% <ø> (ø)` | :arrow_up: |
| [pandas/core/indexes/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZXMucHk=) | `95.53% <ø> (ø)` | :arrow_up: |
| [pandas/core/indexes/numeric.py](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9udW1lcmljLnB5) | `97.18% <ø> (ø)` | :arrow_up: |
| [pandas/core/indexes/interval.py](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9pbnRlcnZhbC5weQ==) | `92.85% <ø> (ø)` | :arrow_up: |
| [pandas/core/indexes/period.py](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9wZXJpb2QucHk=) | `92.77% <ø> (ø)` | :arrow_up: |
| [pandas/core/indexes/multi.py](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9tdWx0aS5weQ==) | `96.9% <ø> (ø)` | :arrow_up: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.73% <0%> (-0.1%)` | :arrow_down: |
| ... and [1 more](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=footer). Last update [0d239d9...723f696](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=h1) Report
> Merging [#17680](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/0d239d9ec0a38d8208269fc688a49f0c3c6a9b2a?src=pr&el=desc) will **increase** coverage by `<.01%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/17680/graphs/tree.svg?width=650&height=150&src=pr&token=eZ4WkYLtcO)](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #17680      +/-   ##
==========================================
+ Coverage   91.23%   91.24%   +<.01%     
==========================================
  Files         163      163              
  Lines       49810    49810              
==========================================
+ Hits        45444    45447       +3     
+ Misses       4366     4363       -3
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.03% <ø> (+0.02%)` | :arrow_up: |
| #single | `40.32% <ø> (-0.07%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/indexes/multi.py](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9tdWx0aS5weQ==) | `96.9% <ø> (ø)` | :arrow_up: |
| [pandas/core/indexes/range.py](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9yYW5nZS5weQ==) | `92.83% <ø> (ø)` | :arrow_up: |
| [pandas/core/indexes/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZXMucHk=) | `95.53% <ø> (ø)` | :arrow_up: |
| [pandas/core/indexes/period.py](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9wZXJpb2QucHk=) | `92.77% <ø> (ø)` | :arrow_up: |
| [pandas/core/indexes/base.py](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9iYXNlLnB5) | `96.29% <ø> (ø)` | :arrow_up: |
| [pandas/core/indexes/timedeltas.py](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy90aW1lZGVsdGFzLnB5) | `91.19% <ø> (ø)` | :arrow_up: |
| [pandas/core/indexes/numeric.py](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9udW1lcmljLnB5) | `97.18% <ø> (ø)` | :arrow_up: |
| [pandas/core/indexes/interval.py](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9pbnRlcnZhbC5weQ==) | `92.85% <ø> (ø)` | :arrow_up: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.73% <0%> (-0.1%)` | :arrow_down: |
| ... and [1 more](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=footer). Last update [0d239d9...723f696](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=h1) Report
> Merging [#17680](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/22515f58c178cdb5cd38c4e56f26dc91c7053550?src=pr&el=desc) will **decrease** coverage by `0.02%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/17680/graphs/tree.svg?width=650&height=150&src=pr&token=eZ4WkYLtcO)](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #17680      +/-   ##
==========================================
- Coverage   91.24%   91.22%   -0.03%     
==========================================
  Files         163      163              
  Lines       49967    49967              
==========================================
- Hits        45593    45583      -10     
- Misses       4374     4384      +10
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.03% <ø> (-0.01%)` | :arrow_down: |
| #single | `40.24% <ø> (-0.07%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/indexes/multi.py](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9tdWx0aS5weQ==) | `96.39% <ø> (ø)` | :arrow_up: |
| [pandas/core/indexes/period.py](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9wZXJpb2QucHk=) | `92.78% <ø> (ø)` | :arrow_up: |
| [pandas/core/indexes/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZXMucHk=) | `95.48% <ø> (-0.1%)` | :arrow_down: |
| [pandas/core/indexes/timedeltas.py](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy90aW1lZGVsdGFzLnB5) | `91.19% <ø> (ø)` | :arrow_up: |
| [pandas/core/indexes/interval.py](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9pbnRlcnZhbC5weQ==) | `92.85% <ø> (ø)` | :arrow_up: |
| [pandas/core/indexes/range.py](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9yYW5nZS5weQ==) | `92.83% <ø> (ø)` | :arrow_up: |
| [pandas/core/indexes/base.py](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9iYXNlLnB5) | `96.46% <ø> (ø)` | :arrow_up: |
| [pandas/core/indexes/numeric.py](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9udW1lcmljLnB5) | `97.18% <ø> (ø)` | :arrow_up: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.74% <0%> (-0.1%)` | :arrow_down: |
| ... and [1 more](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=footer). Last update [22515f5...7688040](https://codecov.io/gh/pandas-dev/pandas/pull/17680?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

Make sure to use sphinx 1.5.6, (not 1.6.*) else you'll be waiting a while.

On Tue, Sep 26, 2017 at 9:56 AM, topper-123 <notifications@github.com>
wrote:

> *@topper-123* commented on this pull request.
> ------------------------------
>
> In pandas/core/indexes/base.py
> <https://github.com/pandas-dev/pandas/pull/17680#discussion_r141082528>:
>
> > +
> +    Examples
> +    --------
> +    >>> pd.Index([1, 2, 3])
> +    Int64Index([1, 2, 3], dtype='int64')
> +
> +    >>> pd.Index(list('abc'))
> +    Index(['a', 'b', 'c'], dtype='object')
> +
> +    See Also
> +    ---------
> +    RangeIndex : Index implementing a monotonic integer range (very
> +                 memory-efficient)
> +    CategoricalIndex : Index with :class:`Categorical` s.
> +    MultiIndex : A multi-level, or hierarchical, Index
> +    IntervalIndex : an Index of :class:`Interval` s.
>
> I hadn't. I've started building the docs and will to the check.
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <https://github.com/pandas-dev/pandas/pull/17680#discussion_r141082528>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/ABQHIk7SdcRbBTmWrAi-UiCpd602c__Sks5smRClgaJpZM4PkEjQ>
> .
>

I've changed according to the various comment. 

In addition, I've also written a section on ``PeriodIndex`` in API.rst and links to ``PeriodIndex`` are now ok.

EDIT: there were some error for ``Period`` in API.rst, which are corrected.
One more thing: In the doc string for ``Int64Index`` it says: "This is the default index type used by the DataFrame and Series ctors when no explicit index is provided by the user"

I assume this is wrong and the phrase should be moved over to ``RangeIndex``?

EDIT: I've moved that phrase over to ``RangeIndex``. Let me know it you disagree.
Added some very small comments.  This is fine as-is though; you don't need to go out of your way to address my comments unless you want to.
> One more thing: In the doc string for Int64Index it says: "This is the default index type used by the DataFrame and Series ctors when no explicit index is provided by the user"
I assume this is wrong and the phrase should be moved over to RangeIndex?

Yes that is a left-over from when RangeIndex did not exist.
I've added a comment in ``RangeIndex`` regarding computational speed, otherwise unchanged.

Is this ok to accept, or are there reservations?
Yes, thanks a lot @topper-123 !