Skip to content
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

Error when using leftLabels/rightLabels #38

Open
gbmd opened this issue Apr 18, 2021 · 4 comments
Open

Error when using leftLabels/rightLabels #38

gbmd opened this issue Apr 18, 2021 · 4 comments

Comments

@gbmd
Copy link

gbmd commented Apr 18, 2021

if len(labels > 0):

pretty sure this should be len(labels) > 0...

       df_compare['pred_RF'].values,
       colorDict=colorDict,
       figure_name='visualization/output/sankeytest',
       rightLabels=['C','I','R','P','AUX'])```

yields 

`Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/home/georg/.local/share/virtualenvs/pvpotential-aZgESz7z/lib/python3.8/site-packages/pySankey/sankey.py", line 119, in sankey
    check_data_matches_labels(leftLabels, df['right'], 'right')
  File "/home/georg/.local/share/virtualenvs/pvpotential-aZgESz7z/lib/python3.8/site-packages/pySankey/sankey.py", line 34, in check_data_matches_labels
    if len(labels >0):
TypeError: '>' not supported between instances of 'str' and 'int'`
@Pierre-Sassoulas
Copy link
Contributor

Duplicate of almost half of the issue in this repo #23

@endolith
Copy link

https://addons.mozilla.org/en-US/firefox/addon/lovely-forks/ :)

@Pierre-Sassoulas
Copy link
Contributor

Nice addon @endolith ! Although it does not seem to work for fork of forks.

@auesro
Copy link

auesro commented Mar 20, 2024

Just to help out others coming after this issue and related ones:

Installing pySankeyBeta works, the error regarding len(labels) > 0 is fixed, the "problem" is:
leftLabels and rightLabels must be provided in a Bottom-Top order to the sankey function.
For example: if you want A, B, C, D to be your left labels, appearing in that order from the top to the bottom of the figure, then leftLabels = ['D','C','B','A']

It is a small detail, but I did not find it mentioned anywhere. I just discovered it by chance.

Hope it helps others!

A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants