dipanjanS / practical-machine-learning-with-python

Master the essential skills needed to recognize and solve complex real-world problems with Machine Learning and Deep Learning by leveraging the highly popular Python Machine Learning Eco-system.
Apache License 2.0
2.28k stars 1.65k forks source link

Index Error #19

Open gopinathankm opened 5 years ago

gopinathankm commented 5 years ago

When execute following statement from .ipynb file `neg_idx = df[(df.news_category=='technology') & (df.sentiment_score == -15)].index[0]

I get following IndexError Traceback (most recent call last)

in ----> 5 neg_idx = df[(df.news_category=='technology') & (df.sentiment_score == -15)].index[1] ~/anaconda3/envs/myenv/lib/python3.7/site-packages/pandas/core/indexes/base.py in __getitem__(self, key) 2082 2083 if is_scalar(key): -> 2084 return getitem(key) 2085 2086 if isinstance(key, slice): IndexError: index 1 is out of bounds for axis 0 with size 0` Any assistance will be appreciated. Gopinathan K.M
raghavbali commented 5 years ago

Hi @gopinathankm Could you mention the particular notebook and chapter you are referring to. Also please mention your pandas and numpy versions

gopinathankm commented 5 years ago

No problem I managed the issue. Thanks

raghavbali commented 5 years ago

@gopinathankm sure. If there's a fix you could share, please do so for everyone else's benefit.