floweaver icon indicating copy to clipboard operation
floweaver copied to clipboard

Note need to restart jupyter after installation in README

Open asoliverez opened this issue 6 years ago • 7 comments

I have a pandas dataframe, and I'm trying to get a sankey diagram out of it.

Here's the excerpt of code, copied mostly from the quickstart tutorial.

from ipysankeywidget import SankeyWidget
from floweaver import *
import pandas as pd

flowDf = lostWonDf.sort_values(['LeadSource','WonCount'], ascending=[True,False]).groupby(['LeadSource','WonCount','Type'], sort=False).agg({
    'AmountGBP':'sum'
}).reset_index()
flowDf.rename(columns={'LeadSource':'source','AmountGBP':'value','Type':'type'}, inplace=True)
flowDf['target'] = flowDf.WonCount.apply(lambda x: 'Won' if x == 1 else 'Lost')
flowDf.drop('WonCount', axis=1, inplace=True)

SankeyWidget(links=flowDf.to_dict('records'))

I get this error when I run the cell.


TypeError Traceback (most recent call last) in () 13 #.unstack().reset_index().set_index('LeadSource') 14 ---> 15 SankeyWidget(links=flowDf.to_dict('records')) 16 17 size = dict(width=570, height=300)

TypeError: wrap() got an unexpected keyword argument 'links'

asoliverez avatar Apr 24 '18 22:04 asoliverez

It was an install error. After restarting jupyter, it worked fine.

asoliverez avatar Apr 25 '18 11:04 asoliverez

Great, glad it's working now. If there's anything that was missing from the instructions that would have made it easier to get started then let us know.

ricklupton avatar Apr 25 '18 21:04 ricklupton

The examples and tutorials are great. This particular issue hit me because I had to restart jupyter to get it working. Might be worth adding a note to restart it after installing the extension

asoliverez avatar Apr 26 '18 14:04 asoliverez

Thanks for the feedback. If you'd like to, it'd be great if you want to add a note yourself! You can edit the README.md file and add something, probably just where it says "To get started, open the quickstart tutorial in Jupyter notebook and step through the notebook cells to produce the fruit example shown above.". Any questions let me know.

ricklupton avatar Apr 27 '18 17:04 ricklupton

Reopening as an easy first contribution to the README. If anyone would like to get involved, this would be a great way to get started.

  1. Fork the repository as described in CONTRIBUTING.md
  2. Add some text to the README file as noted above. Something like "Note: you may have to restart jupyter after installing the extensions before they can be used in the notebook." You can do this on your own computer and commit & push using git, or do it on Github directly using the :pencil2: icon.
  3. Open a pull request as described in CONTRIBUTING.md

Any questions let us know by commenting below. :smiley:

ricklupton avatar May 09 '18 07:05 ricklupton

@ricklupton I would love to tackle this :)

eyaltrabelsi avatar Oct 10 '19 05:10 eyaltrabelsi

@eyaltrabelsi Welcome, please have a go! :)

Do ask If you have any questions.

ricklupton avatar Oct 14 '19 14:10 ricklupton