Following this post I tried this to delete two columns from a dataframe:
import pandas as pd
from io import StringIO
A_csv = """cases,population,country,year,type,count
745,19987071,Afghanistan,1999,population,19987071
2666,20595360,Afghanistan,2000,population,20595360
37737,172006362,Brazil,1999,population,172006362
80488,174504898,Brazil,2000,population,174504898
212258,1272915272,China,1999,population,1272915272
213766,1280428583,China,2000,population,1280428583"""
with StringIO(A_csv) as fp:
A = pd.read_csv(fp)
print(A)
print()
dropcols = ["type", "count"]
A = A.drop(dropcols, axis = 1, inplace = True)
print(A)
result
cases population country year type count
0 745 19987071 Afghanistan 1999 population 19987071
1 2666 20595360 Afghanistan 2000 population 20595360
2 37737 172006362 Brazil 1999 population 172006362
3 80488 174504898 Brazil 2000 population 174504898
4 212258 1272915272 China 1999 population 1272915272
5 213766 1280428583 China 2000 population 1280428583
None
Is there something obvious that is escaping me?