-
Notifications
You must be signed in to change notification settings - Fork 63
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
Add example to create graph from pandas data frame and change style interactively #149
Comments
Hey @joseberlines happily mariana has already implemented this! Check out the DF example: |
Hi @ianhi thanks for the answer. If that is already implemented then there is a bit of info missing in the example.
So it would be possible to play around with pandas and for instance apply functions to the whole data in order to get the coloraturas of the nodes etc. In the example that you mentioned it is possible to see that actually a df can be the input to a ipycytoscape, that means that the pandas might contain more data for styling etc. I don't know if that is the case. That poses some problems since plausibility checks are necessary for data compatibility. This opens many possibilities because by combining the plotting of graphs with ipywidgets its possible to filter the graph easily using pandas functionality. |
Yeah, unfortunately the This is has been implemented for both JSON and networkx but not yet dataframes. See #64 (comment) |
The idea here being also for the user not having to touch any CSS or HTML code. I see ipycytoscape as part of the ipywidgets family. The idea is not needing to touch CSS and HTML and being able to deploy dashboards with voila with just one language, python. |
Thanks for the reply @ianhi, I completely forgot about this. I reopened the issue! :) @joseberlines, what you mean is that you would like to set the color of the nodes and edges based on what's written on the columns, right? (That's an amazing idea! Never thought of that). |
yes @marimeireles, in this way you can basically work with pandas and create the conditional formatting all in pandas. for instance
you have totally power to redefine the characteristics of the graph without getting out of the pandas world. This is actually something related to a suggestion I made related to ipysheet, Same philosophy. If relying on the user for creating a pandas that complains with all the requirements is too much, another approach would be:
obviously if the Len of the list is not the same error is raised. |
This might be a good example for people willing to try it on hacktoberfest. |
Hi, can someone tell me about hacktoberfest? where? how? thanks |
Hey @joseberlines sure! :) |
@marimeireles per https://hacktoberfest.digitalocean.com/hacktoberfest-update PRs will only count if we add the I was about to go add it but then noticed that no other quantstack repo has any topics, is there a quantstack policy against having topics? |
No probs @ianhi, I missed this update. Thanks! :) |
@ianhi I just did, actually. wasn't sure if you could do it. Thanks again! <3 |
Hi @marimeireles & @ianhi , I am still coding this idea which is taken more time than I expected. Can any of you provide me with complete set of parameters that could be handled by ipycytoscape (as pointed out in issue #175 ) minute 15.06 of the Jupiter con conference YouTube video. thx. |
Dear all, I was about to open a discussion issue about this item but we might go on discussing it here. So far my idea is the following
where nodes_df is a DF containing the following columns related to the attributes: and some others related to style (background colour, shape -if possible-, tooltip, etc) the same applies for edges_df where there is a check that all the source-target connections are nodes present in the nodes df. Otherwise error is raised. the method will build the graph node by note, edge by edge and build a style object added to the ipycytoscape object. What do you think? @marimeireles @ianhi @sven5s NOTE: this is the reason why I asked #192 in order to facilitate the node construction. |
Playing around with example:
https://github.com/QuantStack/ipycytoscape/blob/master/examples/Labels%20example.ipynb
I have been thinking if it would be worth to implement a solution that would create a graph out of a pandas data frame.
The nature of a graph is not easily represented as table, but for some straight forward cases might be useful since in data science we are all confronted with pandas eventually.
I can imagine a column with the names of the nodes and another column for directed edges and other columns for representation layouts (colours, etc).
Some thoughts about this are welcome.
The text was updated successfully, but these errors were encountered: