Fixed to_html ignoring index_names parameter
 - [x ] closes #16493
 - [ ] tests added / passed
 - [ ] passes ``git diff upstream/master --name-only -- '*.py' | flake8 --diff``
 - [ ] whatsnew entry

Thanks. Could you add a test to verify the output is correct? Something simple like

```python
df = pd.DataFrame({"A": [1, 2], index=pd.Index(['a', 'b'], name='myindexname'})
result = df.to_html(index_names=False)
assert 'myindexname' not in result
```

You should probably also do some checking that there blank rows aren't put in either.
It can go in `pandas/tests/io/formats/test_to_html.py` 

Also need a release not in `doc/source/whatsnew/v0.20.2.txt`. Thanks! Oh, you'll also need to use `self.fmt.show_index_names` (need the `.fmt` in there). For reference, most (all?) of the common DataFrame formatting arguments are bundled into a `DataFrameFormatter`, which is then passed as the first argument to `HTMLFormatter`. ok, sorry, was a bit too hasty. please check the new pull request.

On Thu, May 25, 2017 at 3:31 PM, Tom Augspurger <notifications@github.com>
wrote:

> Oh, you'll also need to use self.fmt.show_index_names (need the .fmt in
> there). For reference, most (all?) of the common DataFrame formatting
> arguments are bundled into a DataFrameFormatter, which is then passed as
> the first argument to HTMLFormatter.
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/pandas-dev/pandas/pull/16495#issuecomment-304010556>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AAxTkORU50RSmLEDmMBEy8ugUNCRFTkLks5r9YKpgaJpZM4NmWv6>
> .
>



-- 

Christian Prinoth
 I used show_index_names on purpose, based on this line:
[image: Inline image 1]
should line 372 be modified as well for consistency with the parameter name?

On Thu, May 25, 2017 at 6:33 PM, Tom Augspurger <notifications@github.com>
wrote:

> *@TomAugspurger* commented on this pull request.
>
> Sorry, looks like it's saved as show_index_names on DataFrameFormatter,
> not index_names.
>
> FYI you can test it locally with pytest pandas/tests/io/formats/test_to_html.py
> -k test_to_html_with_index_names_false. It also looks like that line is
> too long: https://travis-ci.org/pandas-dev/pandas/jobs/236007626#L2829
> ------------------------------
>
> In doc/source/whatsnew/v0.20.2.txt
> <https://github.com/pandas-dev/pandas/pull/16495#discussion_r118525527>:
>
> > @@ -59,6 +59,7 @@ I/O
>  - Bug in pd.read_csv() when comment is passed in space deliminted text files (:issue:`16472`)
>  - Bug that would force importing of the clipboard routines unnecessarily, potentially causing an import error on startup (:issue:`16288`)
>  - Bug that raised IndexError HTML-rendering an empty DataFrame (:issue:`15953`)
> +- Bug where to_html ignored the index_names parameter (:issue:`16493`)
>
> Change to_html to
>
> ``DataFrame.to_html``
>
> and put index_names in double backticks
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/pandas-dev/pandas/pull/16495#pullrequestreview-40326715>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AAxTkBwtcWgWwtMK5vtuZtMIeoUyn9qhks5r9a1bgaJpZM4NmWv6>
> .
>



-- 

Christian Prinoth
 Your image didn't show up, so I don't know what lines you're referring to.

You shouldn't have to change any parameter names. I must have been confused though. The current version is correct (the line might be too long though. Try `flake8 pandas/io/formats/format.py` to make sure) # [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16495?src=pr&el=h1) Report
> Merging [#16495](https://codecov.io/gh/pandas-dev/pandas/pull/16495?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/e41fe7f52a7ae6be962e683f40500624b2ba2cf6?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `100%`.

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

```diff
@@           Coverage Diff           @@
##           master   #16495   +/-   ##
=======================================
  Coverage   90.43%   90.43%           
=======================================
  Files         161      161           
  Lines       51045    51045           
=======================================
  Hits        46161    46161           
  Misses       4884     4884
```

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

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/16495?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/formats/format.py](https://codecov.io/gh/pandas-dev/pandas/pull/16495?src=pr&el=tree#diff-cGFuZGFzL2lvL2Zvcm1hdHMvZm9ybWF0LnB5) | `96.02% <100%> (ø)` | :arrow_up: |

------

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

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

```diff
@@            Coverage Diff             @@
##           master   #16495      +/-   ##
==========================================
+ Coverage   90.43%   90.79%   +0.36%     
==========================================
  Files         161      161              
  Lines       51045    51063      +18     
==========================================
+ Hits        46161    46365     +204     
+ Misses       4884     4698     -186
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.63% <100%> (+0.36%)` | :arrow_up: |
| #single | `40.15% <0%> (-0.01%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/16495?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/formats/format.py](https://codecov.io/gh/pandas-dev/pandas/pull/16495?src=pr&el=tree#diff-cGFuZGFzL2lvL2Zvcm1hdHMvZm9ybWF0LnB5) | `96.02% <100%> (ø)` | :arrow_up: |
| [pandas/plotting/\_converter.py](https://codecov.io/gh/pandas-dev/pandas/pull/16495?src=pr&el=tree#diff-cGFuZGFzL3Bsb3R0aW5nL19jb252ZXJ0ZXIucHk=) | `63.23% <0%> (-1.82%)` | :arrow_down: |
| [pandas/core/categorical.py](https://codecov.io/gh/pandas-dev/pandas/pull/16495?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY2F0ZWdvcmljYWwucHk=) | `95.5% <0%> (-0.42%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/16495?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.66% <0%> (-0.03%)` | :arrow_down: |
| [pandas/core/reshape/pivot.py](https://codecov.io/gh/pandas-dev/pandas/pull/16495?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvcmVzaGFwZS9waXZvdC5weQ==) | `95.08% <0%> (ø)` | :arrow_up: |
| [pandas/core/resample.py](https://codecov.io/gh/pandas-dev/pandas/pull/16495?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvcmVzYW1wbGUucHk=) | `96.09% <0%> (+0.01%)` | :arrow_up: |
| [pandas/core/generic.py](https://codecov.io/gh/pandas-dev/pandas/pull/16495?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ2VuZXJpYy5weQ==) | `92.26% <0%> (+0.09%)` | :arrow_up: |
| [pandas/core/series.py](https://codecov.io/gh/pandas-dev/pandas/pull/16495?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc2VyaWVzLnB5) | `94.9% <0%> (+0.18%)` | :arrow_up: |
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/16495?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `80.98% <0%> (+0.19%)` | :arrow_up: |
| [pandas/io/parsers.py](https://codecov.io/gh/pandas-dev/pandas/pull/16495?src=pr&el=tree#diff-cGFuZGFzL2lvL3BhcnNlcnMucHk=) | `95.66% <0%> (+0.32%)` | :arrow_up: |
| ... and [4 more](https://codecov.io/gh/pandas-dev/pandas/pull/16495?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16495?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/16495?src=pr&el=footer). Last update [e41fe7f...567ae69](https://codecov.io/gh/pandas-dev/pandas/pull/16495?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
 what I meant is that the name of parameter of the to_html method is
"index_names". Internally, in the fmt structure, it is renamed
"show_index_names", which I then use to determine whether relevant header
row should be included in the html table.

I fixed the line too long by replacing with all(...) and splitting content
of statement on several lines.

On Thu, May 25, 2017 at 7:21 PM, Tom Augspurger <notifications@github.com>
wrote:

> Your image didn't show up, so I don't know what lines you're referring to.
>
> You shouldn't have to change any parameter names. I must have been
> confused though. The current version is correct (the line might be too long
> though. Try flake8 pandas/io/formats/format.py to make sure)
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/pandas-dev/pandas/pull/16495#issuecomment-304068837>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AAxTkCFVXJMcYmjNAZgT08zZaDQWn8DLks5r9biHgaJpZM4NmWv6>
> .
>



-- 

Christian Prinoth
 Sounds good. Looks like a small issue with the usage of `all`:
https://travis-ci.org/pandas-dev/pandas/jobs/236274960#L1522

        if all(self.fmt.has_index_names,

                self.fmt.index,

>               self.fmt.show_index_names):

It takes an iterable of booleans. So something like

```python
        if all((self.fmt.has_index_names,
                self.fmt.index,
                self.fmt.show_index_names)):
```


On Fri, May 26, 2017 at 2:17 AM, Christian Prinoth <notifications@github.com
> wrote:

> what I meant is that the name of parameter of the to_html method is
> "index_names". Internally, in the fmt structure, it is renamed
> "show_index_names", which I then use to determine whether relevant header
> row should be included in the html table.
>
> I fixed the line too long by replacing with all(...) and splitting content
> of statement on several lines.
>
> On Thu, May 25, 2017 at 7:21 PM, Tom Augspurger <notifications@github.com>
> wrote:
>
> > Your image didn't show up, so I don't know what lines you're referring
> to.
> >
> > You shouldn't have to change any parameter names. I must have been
> > confused though. The current version is correct (the line might be too
> long
> > though. Try flake8 pandas/io/formats/format.py to make sure)
> >
> > —
> > You are receiving this because you authored the thread.
> > Reply to this email directly, view it on GitHub
> > <https://github.com/pandas-dev/pandas/pull/16495#issuecomment-304068837
> >,
> > or mute the thread
> > <https://github.com/notifications/unsubscribe-auth/
> AAxTkCFVXJMcYmjNAZgT08zZaDQWn8DLks5r9biHgaJpZM4NmWv6>
> > .
> >
>
>
>
> --
>
> Christian Prinoth
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <https://github.com/pandas-dev/pandas/pull/16495#issuecomment-304210870>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/ABQHIk1akgdSoB5zNBsxUOIiTH8E2waKks5r9nyNgaJpZM4NmWv6>
> .
>
 done and pushed. You certainly are a patient guy ;)

On Fri, May 26, 2017 at 1:42 PM, Tom Augspurger <notifications@github.com>
wrote:

> Sounds good. Looks like a small issue with the usage of `all`:
> https://travis-ci.org/pandas-dev/pandas/jobs/236274960#L1522
>
> if all(self.fmt.has_index_names,
>
> self.fmt.index,
>
> > self.fmt.show_index_names):
>
> It takes an iterable of booleans. So something like
>
> ```python
> if all((self.fmt.has_index_names,
> self.fmt.index,
> self.fmt.show_index_names)):
> ```
>
>
> On Fri, May 26, 2017 at 2:17 AM, Christian Prinoth <
> notifications@github.com
> > wrote:
>
> > what I meant is that the name of parameter of the to_html method is
> > "index_names". Internally, in the fmt structure, it is renamed
> > "show_index_names", which I then use to determine whether relevant header
> > row should be included in the html table.
> >
> > I fixed the line too long by replacing with all(...) and splitting
> content
> > of statement on several lines.
> >
> > On Thu, May 25, 2017 at 7:21 PM, Tom Augspurger <
> notifications@github.com>
> > wrote:
> >
> > > Your image didn't show up, so I don't know what lines you're referring
> > to.
> > >
> > > You shouldn't have to change any parameter names. I must have been
> > > confused though. The current version is correct (the line might be too
> > long
> > > though. Try flake8 pandas/io/formats/format.py to make sure)
> > >
> > > —
> > > You are receiving this because you authored the thread.
> > > Reply to this email directly, view it on GitHub
> > > <https://github.com/pandas-dev/pandas/pull/16495#
> issuecomment-304068837
> > >,
> > > or mute the thread
> > > <https://github.com/notifications/unsubscribe-auth/
> > AAxTkCFVXJMcYmjNAZgT08zZaDQWn8DLks5r9biHgaJpZM4NmWv6>
> > > .
> > >
> >
> >
> >
> > --
> >
> > Christian Prinoth
> >
> > —
> > You are receiving this because you were mentioned.
> > Reply to this email directly, view it on GitHub
> > <https://github.com/pandas-dev/pandas/pull/16495#issuecomment-304210870
> >,
> > or mute the thread
> > <https://github.com/notifications/unsubscribe-auth/
> ABQHIk1akgdSoB5zNBsxUOIiTH8E2waKks5r9nyNgaJpZM4NmWv6>
> > .
>
> >
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/pandas-dev/pandas/pull/16495#issuecomment-304262924>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AAxTkPThnPifm9cu86Rkt0uj66QyXEHwks5r9rqlgaJpZM4NmWv6>
> .
>



-- 

Christian Prinoth
 @CRP make sure to pull this branch before pushing those fixes. I pushed a commit fixing a small lint error. sorry you lost me, what else do i need to do to close this issue?

On Wed, May 31, 2017 at 4:41 AM, Tom Augspurger <notifications@github.com>
wrote:

> @CRP <https://github.com/crp> make sure to pull this branch before
> pushing those fixes. I pushed a commit fixing a small lint error.
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <https://github.com/pandas-dev/pandas/pull/16495#issuecomment-305066039>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AAxTkNcnCBSRTYn8xLqeJu-1cKCrbPRGks5r_NNKgaJpZM4NmWv6>
> .
>



-- 

Christian Prinoth
 thanks!