ENH: Add to_latex() method to Series (#16180)
State: closed

This changeset adds _repr_latex_ to the Series class and moves
the to_latex() method from the DataFrame class to the NDFrame
class.

 - [ ] closes #16180
 - [ ] tests added / passed
 - [ ] passes ``git diff upstream/master --name-only -- '*.py' | flake8 --diff``
 - [ ] whatsnew entry


Labels:
name: Enhancement
name: IO LaTeX
description: to_latex

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16465?src=pr&el=h1) Report
> Merging [#16465](https://codecov.io/gh/pandas-dev/pandas/pull/16465?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/04356a83c0dc8a749c84e168535e6673f2548ec6?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/16465/graphs/tree.svg?height=150&src=pr&token=eZ4WkYLtcO&width=650)](https://codecov.io/gh/pandas-dev/pandas/pull/16465?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #16465      +/-   ##
==========================================
+ Coverage   90.42%   90.42%   +<.01%     
==========================================
  Files         161      161              
  Lines       51027    51032       +5     
==========================================
+ Hits        46142    46147       +5     
  Misses       4885     4885
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.26% <100%> (ø)` | :arrow_up: |
| #single | `40.17% <26.08%> (-0.01%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/16465?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/16465?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.67% <ø> (-0.02%)` | :arrow_down: |
| [pandas/core/generic.py](https://codecov.io/gh/pandas-dev/pandas/pull/16465?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ2VuZXJpYy5weQ==) | `92.2% <100%> (+0.07%)` | :arrow_up: |
| [pandas/core/series.py](https://codecov.io/gh/pandas-dev/pandas/pull/16465?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc2VyaWVzLnB5) | `94.73% <100%> (+0.01%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16465?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/16465?src=pr&el=footer). Last update [04356a8...e57acc2](https://codecov.io/gh/pandas-dev/pandas/pull/16465?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/16465?src=pr&el=h1) Report
> Merging [#16465](https://codecov.io/gh/pandas-dev/pandas/pull/16465?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/04356a83c0dc8a749c84e168535e6673f2548ec6?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/16465/graphs/tree.svg?height=150&src=pr&token=eZ4WkYLtcO&width=650)](https://codecov.io/gh/pandas-dev/pandas/pull/16465?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #16465      +/-   ##
==========================================
+ Coverage   90.42%   90.43%   +<.01%     
==========================================
  Files         161      161              
  Lines       51027    51048      +21     
==========================================
+ Hits        46142    46164      +22     
+ Misses       4885     4884       -1
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.27% <100%> (ø)` | :arrow_up: |
| #single | `40.16% <24%> (-0.01%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/16465?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/16465?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.66% <ø> (-0.03%)` | :arrow_down: |
| [pandas/core/generic.py](https://codecov.io/gh/pandas-dev/pandas/pull/16465?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ2VuZXJpYy5weQ==) | `92.26% <100%> (+0.13%)` | :arrow_up: |
| [pandas/io/feather\_format.py](https://codecov.io/gh/pandas-dev/pandas/pull/16465?src=pr&el=tree#diff-cGFuZGFzL2lvL2ZlYXRoZXJfZm9ybWF0LnB5) | `85.71% <0%> (-2.17%)` | :arrow_down: |
| [pandas/io/parsers.py](https://codecov.io/gh/pandas-dev/pandas/pull/16465?src=pr&el=tree#diff-cGFuZGFzL2lvL3BhcnNlcnMucHk=) | `95.33% <0%> (+0.01%)` | :arrow_up: |
| [pandas/core/ops.py](https://codecov.io/gh/pandas-dev/pandas/pull/16465?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvb3BzLnB5) | `91.69% <0%> (+0.01%)` | :arrow_up: |
| [pandas/plotting/\_core.py](https://codecov.io/gh/pandas-dev/pandas/pull/16465?src=pr&el=tree#diff-cGFuZGFzL3Bsb3R0aW5nL19jb3JlLnB5) | `81.92% <0%> (+0.02%)` | :arrow_up: |
| [pandas/core/window.py](https://codecov.io/gh/pandas-dev/pandas/pull/16465?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvd2luZG93LnB5) | `96.48% <0%> (+0.23%)` | :arrow_up: |

------

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

@TomAugspurger Thanks for the review! Moved things around per your suggestions and added a test explicitly for `Series.to_latex()`. It's a very simple test to make sure the function works; wasn't sure if the entire suite of dataframe-related latex test options was worth repeating for a series. Happy to add more if you think it's helpful.
@bsweger this looks fantastic. I'm pushing a tiny doc change that I forgot to ask for (adding a note that it was added to series in 0.20.2), then merging.

https://github.com/pandas-dev/pandas/pull/16465/commits/95ab5653cc9c1262bfd591f51ed38ba6181070a2 has the doc fixup.

Thanks!