Skip to content

ENH: #8750 add Series support for to_html and _repr_html_ #10300

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

Closed
wants to merge 1 commit into from

Conversation

lexual
Copy link
Contributor

@lexual lexual commented Jun 6, 2015

closes #5563

@sinhrks sinhrks added Output-Formatting __repr__ of pandas objects, to_string IO HTML read_html, to_html, Styler.apply, Styler.applymap labels Jun 6, 2015
return df._repr_html_(*args, **kwargs)

def to_html(self, *args, **kwargs):
df = self.to_frame()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be a call of _repr_html_?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have called DataFrame's _repr_html in Series _repr_html and DataFrame's to_html in Series to_html.

If you look at the test case they have 2 different behaviours/outcomes.

Do you recommend only calling _repr_html in both cases and the behaviour being inconsistent with the DataFrame behaviour?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, sorry. I overlooked differences.

@shoyer
Copy link
Member

shoyer commented Jun 7, 2015

@lexual Could you add a image showing what the new _repr_html_ looks like for Series? The main challenge here is that we'd like to be sure it remains clearly visually distinct from that for DataFrame.

@shoyer
Copy link
Member

shoyer commented Jun 7, 2015

Looking through your code, I see that you are basically just calling s.to_frame()._repr_html(). This is a bit of a non-starter -- we need something that is obviously different. Users should know when they're working with a series instead of a frame.

@jreback jreback added this to the 0.17.1 milestone Oct 11, 2015
@jreback
Copy link
Contributor

jreback commented Oct 11, 2015

@lexual can you rebase & add a whatsnew note.

@jreback
Copy link
Contributor

jreback commented Nov 2, 2015

@lexual can you update according to comments

@jreback
Copy link
Contributor

jreback commented Nov 10, 2015

@lexual like to put this in 0.17.1. can you rebase/update

@jorisvandenbossche
Copy link
Member

@jreback Given the last comment of @shoyer above (#10300 (comment)), I don't think this is ready for inclusion in 0.17.1. We should first figure out how we want it to look like (needs to be a distinction from dataframe with one column)

@lexual lexual force-pushed the issue_8750_series_tohtml branch 2 times, most recently from 3739ad6 to 5e0d2c7 Compare November 12, 2015 11:29
@lexual
Copy link
Contributor Author

lexual commented Nov 12, 2015

@jreback have rebased, let us know if merge-able, or needs reworking ;)

@jorisvandenbossche
Copy link
Member

Can you show how the output looks like?

@jreback
Copy link
Contributor

jreback commented Nov 13, 2015

@lexual I think we would like to put this in, but I agree that it can't look like a 1-column frame, maybe same but no header?

@lexual lexual force-pushed the issue_8750_series_tohtml branch from 5e0d2c7 to 969fabe Compare November 14, 2015 07:28
@jreback
Copy link
Contributor

jreback commented Nov 15, 2015

@lexual can you show a render of this?

@jreback jreback modified the milestones: Next Major Release, 0.17.1 Nov 18, 2015
@jreback
Copy link
Contributor

jreback commented Nov 29, 2015

can you update

@jreback
Copy link
Contributor

jreback commented Jan 6, 2016

@lexual can you update?

@jreback
Copy link
Contributor

jreback commented Jan 20, 2016

@lexual can you rebase / update

@jreback
Copy link
Contributor

jreback commented Mar 12, 2016

can you rebase/update.

@jreback jreback removed this from the Next Major Release milestone Mar 13, 2016
@jreback
Copy link
Contributor

jreback commented May 7, 2016

@lexual can you rebase / update

@jreback
Copy link
Contributor

jreback commented May 25, 2016

can you rebase / update?

@sinhrks
Copy link
Member

sinhrks commented Jul 13, 2016

It's nice if you can meet v0.19.0. Otherwise allow me to work this on.

@jorisvandenbossche
Copy link
Member

Closing this, @sinhrks I think you can go ahead (or rebase this one). But see also the comments above that are not yet resolved I think from @shoyer and me:

I see that you are basically just calling s.to_frame()._repr_html(). This is a bit of a non-starter -- we need something that is obviously different. Users should know when they're working with a series instead of a frame.

We should first figure out how we want it to look like (needs to be a distinction from dataframe with one column)

@jorisvandenbossche jorisvandenbossche added this to the No action milestone Jul 21, 2016
@lexual
Copy link
Contributor Author

lexual commented Aug 15, 2016

Apologies haven't been able to respond or rebase as requested in the past.

Did this get merged, or just closed?

Does it need major surgery to get merged, or just rebase & possibly tidy up?

Thanks ;)

@shoyer
Copy link
Member

shoyer commented Aug 15, 2016

I don't think @sinhrks has started on this yet, but he can tell you for sure. It has not been merged but was closed because it was stale. If you are interested in working on this again we can reopen.

The important thing to figure out first (maybe in the linked issue) is what the HTML repr should actually look like.

@ellisonbg
Copy link
Contributor

The styling of HTML tables in the jupyter notebook is provided by the jupyter CSS itself. From this perspective, the HTMl repr simply needs to have a well formed table format with tbody and thead blocks. Should be very simple. Also we should test on the new table styling that is in master of jupyter and jupyterlab...

@jorisvandenbossche
Copy link
Member

@ellisonbg Technically there is indeed no problem, just having _repr_html output a well behaved html snippet.
The issue is more 'design'-related, as we do not want it to look just like a normal table, as in that case it would not distinguish well from a one-column dataframe. Maybe not that difficult, but up to now nobody put forward a concrete proposal for how it could look like.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IO HTML read_html, to_html, Styler.apply, Styler.applymap Output-Formatting __repr__ of pandas objects, to_string
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Series do not display HTML repr
6 participants