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

list index out of range #7

Open
RaulCarrionAc opened this issue Sep 6, 2023 · 1 comment
Open

list index out of range #7

RaulCarrionAc opened this issue Sep 6, 2023 · 1 comment

Comments

@RaulCarrionAc
Copy link

I have this code:

from ExploriPy import EDA
import pandas as pd

df = pd.read_csv('Iris.csv', sep=',', encoding='utf8', na_values = 'nan')
categorico = ['Species']
eda = EDA(df, categorico, OtherFeatures = ['Id'])
eda.TargetAnalysis('SepalLengthCm')

AND RETURN THE NEXT ERROR:

Converting Categorical Features to String...

100%|██████████| 1/1 [00:00<00:00, 5584.96it/s]

Initiating Target Specific Analysis...
SepalLengthCm
Generating Correlation Heatmap...


IndexError Traceback (most recent call last)

in <cell line: 3>()
1 categorico = ['Species']
2 eda = EDA(df, categorico, OtherFeatures = ['Id'])
----> 3 eda.TargetAnalysis('SepalLengthCm')

3 frames

/usr/local/lib/python3.10/dist-packages/ExploriPy/EDA.py in TargetAnalysis(self, target)
100 end = time.time()
101 # print("Time to initialize TargetAnalysis = ",end-start)
--> 102 targetAnalysis.TargetSpecificAnalysis()
103
104

/usr/local/lib/python3.10/dist-packages/ExploriPy/TargetAnalysisContinuous.py in TargetSpecificAnalysis(self)
86 ,target_statistics_dict = self.TargetStatistics()
87 ,NullValue = pd.DataFrame(round((self.df.isnull().sum()/self.df.shape[0])*100)).reset_index().rename(columns={'index': 'Feature',0:'NullPercentage'})
---> 88 ,box_plot_target_filename = self.BoxPlot(self.target)
89 ,ContinuousHistogram_list = self.ContinuousHistogram()
90 ,Anova_df = self.Anova()

/usr/local/lib/python3.10/dist-packages/ExploriPy/TargetAnalysisContinuous.py in BoxPlot(self, feature)
158 fig, ax = plt.subplots()
159 ax = sns.boxplot(y=self.df[feature], ax=ax)
--> 160 box = ax.artists[0]
161 indices = random.sample(range(len(self.SelectedColors)), 2)
162 colors=[self.SelectedColors[i] for i in sorted(indices)]

/usr/local/lib/python3.10/dist-packages/matplotlib/axes/_base.py in getitem(self, key)
1455
1456 def getitem(self, key):
-> 1457 return [artist
1458 for artist in self._axes._children
1459 if self._type_check(artist)][key]

IndexError: list index out of range

imagen

@hackathonworks
Copy link

I am encountering same issue. were you able to fix it?

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

2 participants