DOC: update pandas.DatetimeIndex.to_period docstring(Nairobi)
State: closed

Checklist for the pandas documentation sprint (ignore this if you are doing
an unrelated PR):

- [ x] PR title is "DOC: update the pandas.DatetimeIndex.to_period docstring"
- [ x] The validation script passes: `scripts/validate_docstrings.py pandas.DatetimeIndex.to_period `
- [ x] The PEP8 style check passes: `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ x] The html version looks good: `python doc/make.py --single pandas.DatetimeIndex.to_period `
- [ x] It has been proofread on language by another sprint participant

Please include the output of the validation script below between the "```" ticks:

```

################################################################################
################## Docstring (pandas.DatetimeIndex.to_period) ##################
################################################################################

Cast to PeriodIndex at a particular frequency.

Converts DatetimeIndex to PeriodIndex.

Parameters
----------
freq : string or pandas offset object, optional
    One of pandas date offset string or corresponding objects.

Returns
-------
period : DatetimeIndex

Examples
--------
>>> df = pd.DataFrame({"y": [1,2,3]},
...                   index=pd.to_datetime(["2000-03-31 00:00:00",
...                                         "2000-05-31 00:00:00",
...                                         "2000-08-31 00:00:00"]))
>>> df.index = df.index.to_period("M")
>>> df
            y
2000-03 1
2000-05 2
2000-08 3

See also
--------
pandas.PeriodIndex: Immutable ndarray holding ordinal values
pandas.DatetimeIndex.to_pydatetime: Return DatetimeIndex as object

################################################################################
################################## Validation ##################################
################################################################################

Docstring for "pandas.DatetimeIndex.to_period" correct. :)

```

If the validation script still gives errors, but you think there is a good reason
to deviate in this case (and there are certainly such cases), please state this
explicitly.





Labels:
name: Docs
name: Period
description: Period data type

Comments:
Hello @Denniskamau! Thanks for updating the PR.



Cheers ! There are no PEP8 issues in this Pull Request. :beers: 

##### Comment last updated on March 12, 2018 at 16:17 Hours UTC
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/20131?src=pr&el=h1) Report
> Merging [#20131](https://codecov.io/gh/pandas-dev/pandas/pull/20131?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/840d4323935348a890d6b868f2b18e8dddd22199?src=pr&el=desc) will **decrease** coverage by `<.01%`.
> The diff coverage is `100%`.

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

```diff
@@            Coverage Diff             @@
##           master   #20131      +/-   ##
==========================================
- Coverage   91.72%   91.72%   -0.01%     
==========================================
  Files         150      150              
  Lines       49156    49152       -4     
==========================================
- Hits        45090    45086       -4     
  Misses       4066     4066
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.11% <100%> (-0.01%)` | :arrow_down: |
| #single | `41.84% <100%> (-0.01%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/20131?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/indexes/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/20131/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZXMucHk=) | `95.64% <100%> (ø)` | :arrow_up: |
| [pandas/core/base.py](https://codecov.io/gh/pandas-dev/pandas/pull/20131/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYmFzZS5weQ==) | `96.78% <0%> (-0.02%)` | :arrow_down: |
| [pandas/core/series.py](https://codecov.io/gh/pandas-dev/pandas/pull/20131/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc2VyaWVzLnB5) | `93.85% <0%> (-0.01%)` | :arrow_down: |
| [pandas/core/indexes/base.py](https://codecov.io/gh/pandas-dev/pandas/pull/20131/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9iYXNlLnB5) | `96.66% <0%> (-0.01%)` | :arrow_down: |
| [pandas/core/indexes/multi.py](https://codecov.io/gh/pandas-dev/pandas/pull/20131/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9tdWx0aS5weQ==) | `95.06% <0%> (ø)` | :arrow_up: |
| [pandas/core/generic.py](https://codecov.io/gh/pandas-dev/pandas/pull/20131/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ2VuZXJpYy5weQ==) | `95.84% <0%> (ø)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/20131?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/20131?src=pr&el=footer). Last update [840d432...fa32bcc](https://codecov.io/gh/pandas-dev/pandas/pull/20131?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

Thanks @Denniskamau! I added an example with the frequency being inferred.