Olá, Não estou conseguindo gerar o gráfico
confirmed_by_country[last_date].plot()
Aqui está o código que usei para gerar
last_date = confirmed_by_country.iloc[:,-1]
e
confirmed_by_country = confirmed.groupby('Country/Region').sum()
E abaixo é o erro que aparece
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
<ipython-input-41-79adff188095> in <module>
1 plt.figure(figsize=(20,5))
----> 2 confirmed_by_country[last_date].plot()
3 plt.title('Confirmados por país')
C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\frame.py in __getitem__(self, key)
2804 if is_iterator(key):
2805 key = list(key)
-> 2806 indexer = self.loc._get_listlike_indexer(key, axis=1, raise_missing=True)[1]
2807
2808 # take() does not accept boolean indexers
C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\indexing.py in _get_listlike_indexer(self, key, axis, raise_missing)
1550
1551 self._validate_read_indexer(
-> 1552 keyarr, indexer, o._get_axis_number(axis), raise_missing=raise_missing
1553 )
1554 return keyarr, indexer
C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\indexing.py in _validate_read_indexer(self, key, indexer, axis, raise_missing)
1637 if missing == len(indexer):
1638 axis_name = self.obj._get_axis_name(axis)
-> 1639 raise KeyError(f"None of [{key}] are in the [{axis_name}]")
1640
1641 # We (temporarily) allow for some missing keys with .loc, except in
KeyError: "None of [Int64Index([ 37596, 7380, 38583, 989, 1906, 93, 294569, 41663,\n 23558, 23370,\n ...\n 320343, 1440, 35329, 33755, 964, 16534, 10, 1869,\n 9343, 5261],\n dtype='int64', length=188)] are in the [columns]"
<Figure size 1440x360 with 0 Axes>