I dropped the first two columns using the iloc method in the following code without any problem.
eng_df.drop(eng_df.iloc[:,:2] , axis=1, inplace=True)
But I tried to delete the first row with the iloc method in the following code and it did not work:
eng_df.drop(eng_df.iloc[:1 , :] , inplace=True)
... and get the following warning:
KeyError: "['Country' 'Energy Supply' 'Energy Supply per Capita' '% Renewable'] not found in axis"
I know I can drop the row in different ways, but my question is can I drop rows with the iloc method, if so, how can I do that and what is wrong in my codes? Thanks...