AutoViML / AutoViz

Automatically Visualize any dataset, any size with a single line of code. Created by Ram Seshadri. Collaborators Welcome. Permission Granted upon Request.
Apache License 2.0
1.71k stars 197 forks source link

IndexError: list index out of range #60

Closed moezali1 closed 2 years ago

moezali1 commented 2 years ago

Hi. We have recently integrated AutoViz into PyCaret and I think I found an edge case here that needs to be fixed in AutoViz. This problem only happens when the dataset only has 1 numeric feature. My guess is that it needs at least 2 variables for the scatter plot. The expected fix will basically involve some kind of exception handling.

To reproduce the error:

pip install pycaret

from pycaret.datasets import get_data
data = get_data('cancer')

from pycaret.classification import *
s = setup(data, target = 'Class', session_id = 123, silent = True)

eda()

IndexError Traceback (most recent call last)

in ----> 1 eda() ~\pycaret\pycaret\classification.py in eda(data, target, display_format, **kwargs) 2946 None 2947 """ -> 2948 return pycaret.internal.tabular.eda( 2949 data=data, target=target, display_format=display_format, **kwargs 2950 ) ~\pycaret\pycaret\internal\tabular.py in eda(data, target, display_format, **kwargs) 10397 10398 AV = AutoViz_Class() > 10399 AV.AutoViz( 10400 filename="", dfte=data, depVar=target, chart_format=display_format, **kwargs 10401 ) ~\anaconda3\envs\pycaret-dev\lib\site-packages\autoviz\AutoViz_Class.py in AutoViz(self, filename, sep, depVar, dfte, header, verbose, lowess, chart_format, max_rows_analyzed, max_cols_analyzed, save_plot_dir) 236 #################################################################################### 237 if chart_format.lower() in ['bokeh','server','bokeh_server','bokeh-server', 'html']: --> 238 dft = AutoViz_Holo(filename, sep, depVar, dfte, header, verbose, 239 lowess,chart_format,max_rows_analyzed, 240 max_cols_analyzed, save_plot_dir) ~\anaconda3\envs\pycaret-dev\lib\site-packages\autoviz\AutoViz_Holo.py in AutoViz_Holo(filename, sep, depVar, dfte, header, verbose, lowess, chart_format, max_rows_analyzed, max_cols_analyzed, save_plot_dir) 175 ### You can draw pair scatters only if there are 2 or more numeric variables #### 176 if len(nums) >= 2: --> 177 drawobj2 = draw_pair_scatters_hv(dfin, nums, problem_type, chart_format, dep, 178 classes, lowess, mk_dir, verbose) 179 ls_objects.append(drawobj2) ~\anaconda3\envs\pycaret-dev\lib\site-packages\autoviz\AutoViz_Holo.py in draw_pair_scatters_hv(dfin, nums, problem_type, chart_format, dep, classes, lowess, mk_dir, verbose) 521 quantileable = [x for x in nums if len(dft[x].unique()) > 20] 522 --> 523 x = pnw.Select(name='X-Axis', value=quantileable[0], options=quantileable) 524 y = pnw.Select(name='Y-Axis', value=quantileable[1], options=quantileable) 525 size = pnw.Select(name='Size', value='None', options=['None'] + quantileable) IndexError: list index out of range The code inside PyCaret that integrates AutoViz is as follows: ``` from autoviz.AutoViz_Class import AutoViz_Class AV = AutoViz_Class() AV.AutoViz( filename="", dfte=data, depVar=target, chart_format=display_format, **kwargs ) ```
AutoViML commented 2 years ago

Hi @moezali1 👍 Thanks for the comments and feedback. I will make this quick fix and upload a new version and notify you. AutoViz

AutoViML commented 2 years ago

Thanks for reporting the bug @moezali1 👍 I have fixed it in version 0.1.36 You can upgrade via:

pip install autoviz --upgrade

I am sure you know :-) AutoViML