Jessime / youtube_history

A quick analysis of all Youtube videos in a user's history.
MIT License
83 stars 4 forks source link

Error While Running Script #8

Closed kaushalvivek closed 5 years ago

kaushalvivek commented 5 years ago

OS X Mojave

.ix is deprecated. Please use
.loc for label based indexing or
.iloc for positional indexing

See the documentation here:
http://pandas.pydata.org/pandas-docs/stable/indexing.html#ix-indexer-is-deprecated

Traceback (most recent call last):
  File "youtube_history.py", line 297, in <module>
    analysis.run()
  File "youtube_history.py", line 287, in run
    self.start_analysis()
  File "youtube_history.py", line 276, in start_analysis
    self.compute()
  File "youtube_history.py", line 259, in compute
    self.worst_videos()
  File "youtube_history.py", line 217, in worst_videos
    self.lowest_rating = df_liked.ix[df_liked['average_rating'].idxmin()]
  File "/usr/local/lib/python3.7/site-packages/pandas/core/indexing.py", line 126, in __getitem__
    return self._getitem_axis(key, axis=axis)
  File "/usr/local/lib/python3.7/site-packages/pandas/core/indexing.py", line 1076, in _getitem_axis
    self._validate_key(key, axis)
  File "/usr/local/lib/python3.7/site-packages/pandas/core/indexing.py", line 1434, in _validate_key
    self._convert_scalar_indexer(key, axis)
  File "/usr/local/lib/python3.7/site-packages/pandas/core/indexing.py", line 262, in _convert_scalar_indexer
    return ax._convert_scalar_indexer(key, kind=self.name)
  File "/usr/local/lib/python3.7/site-packages/pandas/core/indexes/numeric.py", line 211, in _convert_scalar_indexer
    ._convert_scalar_indexer(key, kind=kind))
  File "/usr/local/lib/python3.7/site-packages/pandas/core/indexes/base.py", line 2810, in _convert_scalar_indexer
    return self._invalid_indexer('label', key)
  File "/usr/local/lib/python3.7/site-packages/pandas/core/indexes/base.py", line 3012, in _invalid_indexer
    kind=type(key)))
TypeError: cannot do label indexing on <class 'pandas.core.indexes.numeric.Int64Index'> with these indexers [nan] of <class 'float'>
Jessime commented 5 years ago

Seems like a 3.7 issue. Looking into it now!

Jessime commented 5 years ago

It turns out that YouTube has remove all their "average_rating" data in the last couple of years! I now calculate my own "average_rating" by doing (like_counts/(like_counts + dislike_counts)).

Anyway, this should be fixed now. Let me know how it goes.

kaushalvivek commented 5 years ago

Works perfectly now. Thanks for the prompt response, also, great job on the project. Look forward to contributing. :)