anazalea / pySankey

create sankey diagrams with matplotlib
GNU General Public License v3.0
255 stars 96 forks source link

The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() #31

Closed brianpenghe closed 5 years ago

brianpenghe commented 5 years ago

After I fixed the len() error, there was another one:

/usr/local/lib/python3.6/dist-packages/pysankey/sankey.py in check_data_matches_labels(labels, data, side)
     56             data = set(data.unique().tolist())
     57         if isinstance(labels, list):
---> 58             labels = set(labels)
     59         if labels != data:
     60             msg = "\n"

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

Do you know why?

Pierre-Sassoulas commented 5 years ago

I don't know, My intuition would be that we're not casting labels to a boolean line 58 so there should not be an error? I'm welcoming pull request here if you fix the problem. :)

brianpenghe commented 5 years ago

I don't know, My intuition would be that we're not casting labels to a boolean line 58 so there should not be an error? I'm welcoming pull request here if you fix the problem. :)

I possibly figured out why. I was using a npassay as label