-
Notifications
You must be signed in to change notification settings - Fork 27
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
is it possible display several dataframes side by side ? #24
Comments
Hi Dragos! I think the best approach is to just write a little function that puts each table into a cell of another (invisible) table. You can get the HTML representation of an IpyTable object by calling its .repr_html() method. The function multi_table() below accepts a list of tables, calls .repr_html() on each to get their HTML, shoves each one into the cell of a vanilla html table, and renders the resulting blob of html using the HTML() function from IPython.core.display. You should be able to control the formatting (cell spacing, etc) by modifying the code to add more style properties etc. to the html of the outer table. Cheers! from IPython.core.display import HTML
def multi_table(table_list):
''' Acceps a list of IpyTable objects and returns a table which contains each IpyTable in a cell
'''
return HTML(
'<table><tr style="background-color:white;">' +
''.join(['<td>' + table._repr_html_() + '</td>' for table in table_list]) +
'</tr></table>'
) |
Hi Eric
Many thanks for the fast response. I will play around with your solution.
when I will be happy with the output I will come back to you and share my
findings :)
all the best
Dragos
…On Tue, Oct 10, 2017 at 3:41 AM, Eric Moyer ***@***.***> wrote:
Hi Dragos!
I think the best approach is to just write a little function that puts
each table into a cell of another (invisible) table. You can get the HTML
representation of an IpyTable object by calling its .*repr_html*() method.
The function multi_table() below accepts a list of tables, calls .
*repr_html*() on each to get their HTML, shoves each one into the cell of
a vanilla html table, and renders the resulting blob of html using the
HTML() function from IPython.core.display.
You should be able to control the formatting (cell spacing, etc) by
modifying the code to add more style properties etc. to the html of the
outer table.
Cheers!
from IPython.core.display import HTML
def multi_table(table_list):
''' Acceps a list of IpyTable objects and returns a table which contains each IpyTable in a cell '''
return HTML(
'<table><tr style="background-color:white;">' +
''.join(['<td>' + table._repr_html_() + '</td>' for table in table_list]) +
'</tr></table>'
)
[image: mutli_table1]
<https://user-images.githubusercontent.com/136718/31365413-c0734bc0-ad1f-11e7-89b7-237a747742f7.png>
[image: mutli_table2]
<https://user-images.githubusercontent.com/136718/31365417-c2faddfe-ad1f-11e7-9eff-fb24756afce9.png>
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#24 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AfJDwd2OyWdm2pT1X8UwKZeNDu0nHIthks5sqstIgaJpZM4PzGks>
.
|
I am trying to use this solution but there is no module named add_parent_to_path. Is this is a custom module that the author implemented? A wide search in google finds no modules by that name. |
This is great. I just used it on my dataframes. Thanks |
Thank you for your function. Works great! |
Hi
I was wondering if there is a way to use your package to display several data frames side by side in a jupyter notebook cell. kind of being able to replicate the powepoint slides from this youtube video
https://www.youtube.com/watch?v=9d5-Ti6onew
thanks in advance
Dragos
The text was updated successfully, but these errors were encountered: