Repository: pandas-dev/pandas

Issue:
Make DataFrame.to_html output full content
Make DataFrame.to_html output full contents by default. Or at least add option to enable outputting full content. 

#### Code Sample
```python
import pandas as pd
df = pd.DataFrame({
    'id': [1, 2, 3, 4, 5],
    'link': ['http://a_super_loooooooooooooooooooooooooooooooong_link.com', '', '', '', '']
})
df.to_html('df.html')
```
#### Problem description

By default, pandas uses a short representation of a very long string. However, when outputting to HTML, I think users expect the full content to be outputted rather than a short representation. 

#### Expected Output

Full content output is expected. Or least there should be an option to enable outputting full content. 





Discussion:
This reminds me of #16911, though I'm not sure if they're completely related.  I agree that we should also try to truncate based on column length and not just the number of columns.

cc @jreback 
@dclong : If you have ideas how to go out implementing such a feature, PR's are welcome!
The default max_colwidth is 50, and you can set it to a larger number. @dclong 
```
import pandas as pd

pd.options.display.max_colwidth = 100
df = pd.DataFrame({
    'id': [1, 2, 3, 4, 5],
    'link': ['http://a_super_loooooooooooooooooooooooooooooooong_link.com', '', '', '', '']
})
df.to_html('df.html')
```
I stumble into this issue. I would have expected to pass the parameter `max_colwidth` to the `to_html` method similar to the `max_cols` and `max_rows`.

I was wondering which kind of user API would be the best there.

ping @jorisvandenbossche 

Resolving patch:
diff --git a/pandas/io/formats/html.py b/pandas/io/formats/html.py
--- a/pandas/io/formats/html.py
+++ b/pandas/io/formats/html.py
@@ -12,7 +12,7 @@
 
 from pandas.core.dtypes.generic import ABCMultiIndex
 
-from pandas import compat
+from pandas import compat, option_context
 from pandas.core.config import get_option
 
 from pandas.io.common import _is_url
@@ -320,9 +320,15 @@ def _write_header(self, indent):
 
         self.write('</thead>', indent)
 
+    def _get_formatted_values(self):
+        with option_context('display.max_colwidth', 999999):
+            fmt_values = {i: self.fmt._format_col(i)
+                          for i in range(self.ncols)}
+        return fmt_values
+
     def _write_body(self, indent):
         self.write('<tbody>', indent)
-        fmt_values = {i: self.fmt._format_col(i) for i in range(self.ncols)}
+        fmt_values = self._get_formatted_values()
 
         # write values
         if self.fmt.index and isinstance(self.frame.index, ABCMultiIndex):
@@ -486,6 +492,9 @@ class NotebookFormatter(HTMLFormatter):
     DataFrame._repr_html_() and DataFrame.to_html(notebook=True)
     """
 
+    def _get_formatted_values(self):
+        return {i: self.fmt._format_col(i) for i in range(self.ncols)}
+
     def write_style(self):
         # We use the "scoped" attribute here so that the desired
         # style properties for the data frame are not then applied


Test patch:
diff --git a/pandas/tests/io/formats/test_to_html.py b/pandas/tests/io/formats/test_to_html.py
--- a/pandas/tests/io/formats/test_to_html.py
+++ b/pandas/tests/io/formats/test_to_html.py
@@ -15,6 +15,15 @@
 
 import pandas.io.formats.format as fmt
 
+lorem_ipsum = (
+    "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod"
+    " tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim"
+    " veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex"
+    " ea commodo consequat. Duis aute irure dolor in reprehenderit in"
+    " voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur"
+    " sint occaecat cupidatat non proident, sunt in culpa qui officia"
+    " deserunt mollit anim id est laborum.")
+
 
 def expected_html(datapath, name):
     """
@@ -600,3 +609,17 @@ def test_to_html_render_links(render_links, expected, datapath):
     result = df.to_html(render_links=render_links)
     expected = expected_html(datapath, expected)
     assert result == expected
+
+
+@pytest.mark.parametrize('method,expected', [
+    ('to_html', lambda x:lorem_ipsum),
+    ('_repr_html_', lambda x:lorem_ipsum[:x - 4] + '...')  # regression case
+])
+@pytest.mark.parametrize('max_colwidth', [10, 20, 50, 100])
+def test_ignore_display_max_colwidth(method, expected, max_colwidth):
+    # see gh-17004
+    df = DataFrame([lorem_ipsum])
+    with pd.option_context('display.max_colwidth', max_colwidth):
+        result = getattr(df, method)()
+    expected = expected(max_colwidth)
+    assert expected in result