ContextLab / hypertools

A Python toolbox for gaining geometric insights into high-dimensional data
http://hypertools.readthedocs.io/en/latest/
MIT License
1.83k stars 160 forks source link

“NameError: name 'sys' is not defined” in /hypertools/_shared/helpers.py #88

Closed moneyDboat closed 7 years ago

moneyDboat commented 7 years ago

Here's the log

>>>hyp.plot(data, 'o', point_colors=cluster_labels, palette='deep')
Error: keyword arguments must be a list of the same length as x
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "//anaconda/lib/python3.5/site-packages/hypertools/plot/plot.py", line 220, in plot
    return static_plot(x,*args,**kwargs)
  File "//anaconda/lib/python3.5/site-packages/hypertools/plot/static.py", line 105, in static_plot
    kwargs_list = parse_kwargs(x,kwargs)
  File "//anaconda/lib/python3.5/site-packages/hypertools/_shared/helpers.py", line 120, in parse_kwargs
    sys.exit(1)
NameError: name 'sys' is not defined
jeremymanning commented 7 years ago

@moneyDboat can you upload example data and expand out those arguments so that we can reproduce and explore that bug?

moneyDboat commented 7 years ago

I was watching mushrooms.ipynb in "ContextLab/hypertools-paper-notebooks" and use "mushrooms.csv". The code is following. I think "import sys" can fix this simple bug.

import pandas as pd
import hypertools as hyp

data = pd.read_csv('mushrooms.csv')
cluster_labels = hyp.tools.cluster(data, n_clusters=23, ndims=3)

hyp.plot(data, 'o', point_colors= cluster_labels, ndims=2)
andrewheusser commented 7 years ago

@moneyDboat yep, you are right. import sys is missing at the top. This brought up another issue though in the notebook, that I'll also fix. We replaced the point_colors kwarg with group, but didn't update it in the notebook on that commented line. If you use group instead of point colors, the code should work. I'll fix that import statement and the notebook today

andrewheusser commented 7 years ago

fixed in 5833a0a, will be in 0.1.7 release