Make *_range functions consistent
State: closed

- [X] closes #17471
- [X] tests added / passed
- [X] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [X] whatsnew entry

Comments:

- I couldn't find any existing tests of `period_range`, so I created a new file `test_period_range.py` in a similar fashion to the existing files `test_date_range.py` and `test_timedelta_range.py`.
- Cleaned up a few existing tests relevant to this issue (used `with` context where appropriate, etc.).

Labels:
name: API Design
name: Error Reporting
description: Incorrect or improved errors from pandas
name: Interval
description: Interval data type

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17482?src=pr&el=h1) Report
> Merging [#17482](https://codecov.io/gh/pandas-dev/pandas/pull/17482?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/d6df8ea99f2574480e934aae01a1e142f935145e?src=pr&el=desc) will **decrease** coverage by `0.01%`.
> The diff coverage is `100%`.

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

```diff
@@            Coverage Diff             @@
##           master   #17482      +/-   ##
==========================================
- Coverage   91.15%   91.14%   -0.02%     
==========================================
  Files         163      163              
  Lines       49534    49531       -3     
==========================================
- Hits        45153    45144       -9     
- Misses       4381     4387       +6
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.92% <100%> (ø)` | :arrow_up: |
| #single | `40.22% <11.11%> (-0.06%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/17482?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/indexes/interval.py](https://codecov.io/gh/pandas-dev/pandas/pull/17482?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9pbnRlcnZhbC5weQ==) | `93.11% <100%> (+0.5%)` | :arrow_up: |
| [pandas/core/indexes/period.py](https://codecov.io/gh/pandas-dev/pandas/pull/17482?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9wZXJpb2QucHk=) | `92.74% <100%> (ø)` | :arrow_up: |
| [pandas/core/indexes/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/17482?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZXMucHk=) | `95.53% <100%> (ø)` | :arrow_up: |
| [pandas/core/indexes/timedeltas.py](https://codecov.io/gh/pandas-dev/pandas/pull/17482?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy90aW1lZGVsdGFzLnB5) | `90.6% <100%> (+0.01%)` | :arrow_up: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/17482?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/17482?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.72% <0%> (-0.1%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17482?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/17482?src=pr&el=footer). Last update [d6df8ea...523dcea](https://codecov.io/gh/pandas-dev/pandas/pull/17482?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/17482?src=pr&el=h1) Report
> Merging [#17482](https://codecov.io/gh/pandas-dev/pandas/pull/17482?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/fa557f7391589f351b1260f46b3b3db22492f50b?src=pr&el=desc) will **increase** coverage by `<.01%`.
> The diff coverage is `100%`.

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

```diff
@@            Coverage Diff             @@
##           master   #17482      +/-   ##
==========================================
+ Coverage   91.18%   91.19%   +<.01%     
==========================================
  Files         163      163              
  Lines       49545    49582      +37     
==========================================
+ Hits        45179    45214      +35     
- Misses       4366     4368       +2
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.97% <100%> (+0.02%)` | :arrow_up: |
| #single | `40.2% <14.28%> (-0.08%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/17482?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/indexes/interval.py](https://codecov.io/gh/pandas-dev/pandas/pull/17482?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9pbnRlcnZhbC5weQ==) | `93.57% <100%> (+0.95%)` | :arrow_up: |
| [pandas/core/indexes/period.py](https://codecov.io/gh/pandas-dev/pandas/pull/17482?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9wZXJpb2QucHk=) | `92.77% <100%> (+0.03%)` | :arrow_up: |
| [pandas/core/indexes/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/17482?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZXMucHk=) | `95.53% <100%> (ø)` | :arrow_up: |
| [pandas/core/indexes/timedeltas.py](https://codecov.io/gh/pandas-dev/pandas/pull/17482?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy90aW1lZGVsdGFzLnB5) | `91.19% <100%> (+0.6%)` | :arrow_up: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/17482?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/17482?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.77% <0%> (-0.1%)` | :arrow_down: |
| [pandas/core/common.py](https://codecov.io/gh/pandas-dev/pandas/pull/17482?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29tbW9uLnB5) | `91.98% <0%> (+0.32%)` | :arrow_up: |

------

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

ping @jreback

Made the review changes, as well as a few additional things I noticed:
- Found and fixed a corner case bug in my endpoint fix for `interval_range`, which resulted in shuffling around some of that code
  - Also added some additional checks around `periods` (similar to what's done in the other functions)
  - Also added some additonal tests
- Regarding `period_range` when `start` or `end` are `Period` objects (discussed in review comments):
   - Added tests to for this scenario
   - Added an Example section to the `period_range` docstring covering this scenario
   - Added an example of this using the `PeriodIndex` constructor in `timeseries.rst`
- Cleaned up the docstrings of each function and made them as consistent with each other as possible
- Cleaned up a few error messages to make the capitalization consistent with param names

I also noticed string/datetime-like `start`/`end` doesn't work with `interval_range`, despite the docstring saying it does (don't think it ever did).  Should that be fixed here, or is a separate issue/PR more appropriate?
these are all fine: https://github.com/pandas-dev/pandas/pull/17482#issuecomment-328436966 thanks!

> I also noticed string/datetime-like start/end doesn't work with interval_range, despite the docstring saying it does (don't think it ever did). Should that be fixed here, or is a separate issue/PR more appropriate

Datetimelike *should* work with ``interval_range``, as it works with the regular constructors. I don't think strings should work though, its tricky to infer what is mean (IOW it could be a datetime, or a timedelta, or it could be an error). I would raise on strings (but accept datetimelike)

ping on push / green.
ping @jreback 

Made the review changes, and additionally:

- Implemented support for datetime-like in `interval_range`
   - Added a bunch of associated tests
   - Related to previous review comment: note that both not null checks are actually necessary, as one is checking with `periods`, the other `freq`
- Changed a couple `ValueError` to `TypeError`, as that seems like the more appropriate exception
ping @jreback 

Updated datetime-like support.  For some reason I originally thought that datetime-like didn't include timedelta, so I shortcut to just parsing timestamps.  Updated with support for timedelta and added timedelta related tests.
@jreback : cleaned up the `interval_range` constructor
@jreback : Made the doc changes.  Didn't see an obvious location for `interval_range` in api.rst, so I created a new section.  Additionally fixed one minor typo in whatsnew.
thanks @jschendel nice PR, and very responsive! keep em' comin!