Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make DataFrame.to_html output full content #17004

Closed
dclong opened this issue Jul 18, 2017 · 6 comments

Comments

@dclong
Copy link

commented Jul 18, 2017

Make DataFrame.to_html output full contents by default. Or at least add option to enable outputting full content.

Code Sample

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.

@gfyoung

This comment has been minimized.

Copy link
Member

commented Jul 18, 2017

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

@gfyoung

This comment has been minimized.

Copy link
Member

commented Jul 18, 2017

@dclong : If you have ideas how to go out implementing such a feature, PR's are welcome!

@DataYI

This comment has been minimized.

Copy link

commented Nov 15, 2018

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')
@glemaitre

This comment has been minimized.

Copy link
Contributor

commented Jan 19, 2019

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

@simonjayhawkins

This comment has been minimized.

Copy link
Member

commented Jan 19, 2019

I would think that the default should be to ignore the display.max_colwidth when using to_html(), but this would then prevent users having the ability to truncate the output.

so maybe an additional max_colwidth as @glemaitre suggests having the default value of None to ignore display.max_colwidth, a value of True to honor the display.max_colwidth value, or accept an int to override the display.max_colwidth.

@simonjayhawkins

This comment has been minimized.

Copy link
Member

commented Jan 19, 2019

a simpler api would be just max_colwidth: bool default False, we have the set_option and option_context to allow changing the value.

@jreback jreback added this to the 0.25.0 milestone Jan 30, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.