Add option for DataFrame.to_html() to render URL data as links (#2679)
State: closed

- [X] closes #2679
- [X] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry

Two lines were added to tests that exceed the 79 character limit.

Labels:
name: Enhancement
name: IO HTML
description: read_html, to_html, Styler.apply, Styler.applymap

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

 - There are no PEP8 issues in the file [`pandas/core/frame.py`](https://github.com/benarthur91/pandas/blob/385e88f60d603798a39fe9da171466f79818b245/pandas/core/frame.py) !

 - There are no PEP8 issues in the file [`pandas/io/formats/format.py`](https://github.com/benarthur91/pandas/blob/385e88f60d603798a39fe9da171466f79818b245/pandas/io/formats/format.py) !

 - There are no PEP8 issues in the file [`pandas/io/formats/html.py`](https://github.com/benarthur91/pandas/blob/385e88f60d603798a39fe9da171466f79818b245/pandas/io/formats/html.py) !

 - There are no PEP8 issues in the file [`pandas/tests/io/formats/test_to_html.py`](https://github.com/benarthur91/pandas/blob/385e88f60d603798a39fe9da171466f79818b245/pandas/tests/io/formats/test_to_html.py) !



##### Comment last updated on November 26, 2018 at 05:41 Hours UTC
@benarthur91 : This is looking good!  Next up: could you resolve the merge conflicts?
Thanks for the feedback everyone, I've pushed the requested changes. I'm unfamiliar with the PR workflow, so please let me know if I've done anything incorrectly.

Edit: Thanks @gfyoung, I'm assuming this means rebase onto master, resolve conflicts, and force push that branch over the current?
> I'm assuming this means rebase onto master, resolve conflicts, and force push that branch over the current?

Yep, that's correct.
Typically preferred if you merge in the latest master instead of rebasing. Keeps github comment history and doesn’t require a force push
Gotcha, sorry about that. I still have the pre-rebase branch with original commits, would it be helpful if I pushed that one up instead?
> Gotcha, sorry about that. I still have the pre-rebase branch with original commits, would it be helpful if I pushed that one up instead?

@benarthur91 : Just leave it as is and work off what you just pushed.  It's fine.
Does anyone know what might have happened? Getting a seemingly unrelated error in pandas/tests/plotting/test_datetimelike.py, I couldn't see any obvious reason that would have happened.
Might be a weird Travis thing.  Don't forget to fix the `isort` error on the other Travis build though.
Ah, I didn't see a clear error message and assumed it was related to the other failure. As you mention isort, I'm now thinking it's either a) imports are in the wrong order or b) it doesn't like that I'm importing a private method?

Where can I look to find the proper order of imports? Also I ran flake8 on frame.py locally and it reported no issues (even when I changed the order of imports), would you expect it to?
@benarthur91 : You need to install `isort` via `pip` and run the command itself (`isort` <filename>)
Pretty neat :) Thanks for clarifying, I just pushed that change.
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/23715?src=pr&el=h1) Report
> Merging [#23715](https://codecov.io/gh/pandas-dev/pandas/pull/23715?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/b7ee8292b465aa507a37777443efbaecb07b3f57?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/23715/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/23715?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #23715      +/-   ##
==========================================
+ Coverage   92.22%   92.22%   +<.01%     
==========================================
  Files         162      162              
  Lines       51777    51785       +8     
==========================================
+ Hits        47751    47759       +8     
  Misses       4026     4026
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.62% <100%> (ø)` | :arrow_up: |
| #single | `43.01% <11.11%> (-0.01%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/23715?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/23715/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `96.91% <ø> (ø)` | :arrow_up: |
| [pandas/io/formats/format.py](https://codecov.io/gh/pandas-dev/pandas/pull/23715/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2Zvcm1hdHMvZm9ybWF0LnB5) | `97.98% <100%> (ø)` | :arrow_up: |
| [pandas/io/formats/html.py](https://codecov.io/gh/pandas-dev/pandas/pull/23715/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2Zvcm1hdHMvaHRtbC5weQ==) | `98.64% <100%> (+0.03%)` | :arrow_up: |

------

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

Is there anything else I should do to clean this up right now?
Added note to whatsnew and also a short description and example in io.rst

I also checked the last two boxes in the original (autogenerated) comment - I'm assuming that's for me to do and not someone else, but not sure. Let me know if there's anything else I can do.
minor point, pls ping on green. @WillAyd over to you.
Just got in front of keyboard and was about to ping you :smiley: thanks for approving, will wait to hear from @WillAyd.
Thanks @benarthur91 - nice change!
Thanks to everyone for all the help!