-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Add _repr_html method to make DataFrames nice in IPython notebook. #772
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
Conversation
Good idea, I'd been thinking about this recently. If the dataframe is longer than some limit, the standard |
I think It would be nice to put the table in a scrollable div of fixed size. I haven't looked at to_html yet, but do you think that approach makes sense? |
That mitigates the problem, but just testing, I can quickly make a DataFrame with 10M rows. That HTML will probably take some time to generate, and take over a lot of memory (first on the server, then in the browser). So I think there needs to be some cut-off. Another option would be to do a head view - so show the first, say, 50 rows, and have something at the bottom that indicates there's more. |
Now for the ipython notebook, it sounds like a good idea to do something extra on top of |
A scrollable div could definitely be done on top of to_html. But I On Fri, Feb 10, 2012 at 2:27 PM, Wouter Overmeire
Brian E. Granger |
I pulled your code, added a scrollable div and fall over to info representation for large DataFrames ( b570153). Also added a little unit test. |
I see the mechanics of the fallback for large dataframes returns text in a |
@lodagro the summary repr from
|
Also maybe it should use print_config.max_columns instead of 20? |
Reason i did not use print_config variables is because it is in a scrollable div. Ok, i will use the same switch over between full and summary for |
Ah, that's a good point. Maybe just have no limit then on the number of columns since you can scroll right? |
I did put a limit on rows/columns to avoid sending massive amounts of html to the notebook, in case of very large dataframes. So what do we chose? Now that i think of it, what about adding some css styling? I don't know if the notebook can handle it. I can give it a try. |
No preferences there but go right ahead. I have never been the best with those kinds of aesthetics |
A few points:
|
Any plans to add an option to the notebook to disable enriched repr? I actually rather like the plain text output for demos |
We have thought a little about this, but haven't implemented anything yet. On Wed, Feb 22, 2012 at 7:38 PM, Wes McKinney
Brian E. Granger |
Was patiently waiting for feedback, apparently my last comments did not reach github, so repeating
|
I don't really have time to work on this right now but a few comments:
|
DataFrame_repr_html changes according to #772 discussion.
Add global settings for caching list_libraries
This makes DataFrame's show up and nice HTML tables in the IPython notebook. This initial implementation is very plain - but better than the plaintext output. We need to think more about how we want to handle these things, but this is a start.