0

I am getting this error in the code I am running

import pandas
vaccine_data=pandas.read_csv("data.csv",encoding="utf-8-sig")
vaccine_data.shape
vaccine_data.columns
vaccine_data['total_vaccinations']
vaccine_data['total_vaccinations'].mean()
vaccine_data.index
vaccine_data['total_vaccinations','iso_codes']  
--------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
/usr/lib/python3/dist-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance)
   2896             try:
-> 2897                 return self._engine.get_loc(key)
   2898             except KeyError:

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

KeyError: ('total_vaccinations', 'iso_codes')

During handling of the above exception, another exception occurred:

KeyError                                  Traceback (most recent call last)
/tmp/ipykernel_20415/4223756715.py in <module>
----> 1 vaccine_data['total_vaccinations','iso_codes']
    

When I am running individual columns I am not getting any errors but on selecting multiple column I am running into key error

Sid111Math
  • 147
  • 7

0 Answers0