thu-vu92 / youtube-api-analysis

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problem with the upload schedule

leandrod1 opened this issue · comments

Hello I have this error when I try to do the last graphic:

day_df = pd.DataFrame(video_df['publishDayName'].value_counts())
weekdays = [ 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
day_df = day_df.reindex(weekdays)
ax = day_df.reset_index().plot.bar(x='index', y='publishDayName', rot=0)
KeyError                                  Traceback (most recent call last)
File [c:\Users\leand\anaconda3\envs\youtube_ds\Lib\site-packages\pandas\core\indexes\base.py:3652](file:///C:/Users/leand/anaconda3/envs/youtube_ds/Lib/site-packages/pandas/core/indexes/base.py:3652), in Index.get_loc(self, key)
   3651 try:
-> 3652     return self._engine.get_loc(casted_key)
   3653 except KeyError as err:

File [c:\Users\leand\anaconda3\envs\youtube_ds\Lib\site-packages\pandas\_libs\index.pyx:147](file:///C:/Users/leand/anaconda3/envs/youtube_ds/Lib/site-packages/pandas/_libs/index.pyx:147), in pandas._libs.index.IndexEngine.get_loc()

File [c:\Users\leand\anaconda3\envs\youtube_ds\Lib\site-packages\pandas\_libs\index.pyx:176](file:///C:/Users/leand/anaconda3/envs/youtube_ds/Lib/site-packages/pandas/_libs/index.pyx:176), in pandas._libs.index.IndexEngine.get_loc()

File pandas\_libs\hashtable_class_helper.pxi:7080, in pandas._libs.hashtable.PyObjectHashTable.get_item()

File pandas\_libs\hashtable_class_helper.pxi:7088, in pandas._libs.hashtable.PyObjectHashTable.get_item()

KeyError: 'index'

The above exception was the direct cause of the following exception:

KeyError                                  Traceback (most recent call last)
Cell In[150], line 4
      2 weekdays = [ 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
      3 day_df = day_df.reindex(weekdays)
----> 4 ax = day_df.plot.bar(x='index', y='publishDayName', rot=0)
...
   3657     #  InvalidIndexError. Otherwise we fall through and re-raise
   3658     #  the TypeError.
   3659     self._check_indexing_error(key)

KeyError: 'index'

And when I change 'index' for 'count', I have the same error but with 'publishDayName'