I am trying to keep just certain columns of a DataFrame, and it works fine when column names are strings:
In [2]: import numpy as np In [3]: import pandas as pd
Just convert the headers from integer to string. This should be done almost always as a best practice when working with pandas datasets to avoid surprise
df.columns = df.columns.map(str)