-
Notifications
You must be signed in to change notification settings - Fork 58
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
Visualising pandas dataframes with ipythonblocks #29
Comments
Very neat idea, I like it! I've posted a link to this issue on some social media in case others are thinking about this application. |
+1. This would be very useful to demonstrate how df.map, df.apply, etc work. I guess it could extend to joins too, right? That would be a very neat way to teach relational operations. edit: I feel dumb for not looking at the notebook sooner before raising points you've clearly thought about @psychemedia --great work! |
@sburns How do you see the apply and map stuff working? |
@psychemedia def pBlock_applyColour(df, apply_function, colour_func, *args, **kwargs):
applied = df.apply(apply_function)
(y, x) = applied.shape
b = BlockGrid(x, y)
for i in range(x);
for j in range(y):
b[j, i] = colour_func(applied.iloc[j, i])
return b
func = pd.isnull # which we know returns only True or False
colour_func = lambda val: (123, 234, 123) if val else (0, 0, 0)
pBlock_applyColour(df, func, colour_func=colour_func) Now, On the other hand, this whole approach might be too generalized (& hence complex 👎) because after all ipythonblocks is aimed at learners. |
@sburns Ah, okay. I think what I was thinking was a set of canned functions that extend pandas in order to support visualisation of dataframe operations. So I'm not thinking about learners learning how to write and manipulate ipythonblocks functions. Instead, I'm wondering about some additional methods that can be called to help learners see what's going on in their pandas code; so I guess it's debugging support for pandas too... |
@psychemedia Your approach would ultimately be a lot more sustainable & useful to people of all levels of pandas-ability. I know the pandas devs are actively re-thinking how to display dataframes in many varied contexts. |
Hi
Ever since I first saw ipythonblocks a few weeks ago, I started to wonder about the extent to which it might be useful as a way visualising the structure of pandas dataframes, and the results of applying various transformations to them.
I've started sketching some proof of concept ideas out here: http://nbviewer.ipython.org/gist/psychemedia/9795643
If anyone else is interested in chatting through ideas about how to push pandas DataFrame visualisations using ipythonblocks, or is already further on than my experiments are (or has taken a different approach to the same or related issues), please let me know...
The text was updated successfully, but these errors were encountered: