import pandas as pd import numpy as np from sklearn.impute import SimpleImputer df = pd.read_csv("Covid-19 Global Data.csv") df.head(3) Date_reported Country_code Country WHO_region New_cases New_deaths 0 03-01-20 AF Afghanistan EMRO 0 0 1 04-01-20 AF Afghanistan EMRO 0 0 2 05-01-20 AF Afghanistan EMRO 0 0 df.drop(["Country"],axis=1,inplace=True) Showing keyerror everytime. The dataframe is constructed perfectly but KeyError is popping up.