use column index pandas code example
Example 1: define a column as index pandas
myDataFrame.set_index('column_name')
Example 2: indexing column in pandas
In [10]: type(titanic[["Age", "Sex"]])
Out[10]: pandas.core.frame.DataFrame
myDataFrame.set_index('column_name')
In [10]: type(titanic[["Age", "Sex"]])
Out[10]: pandas.core.frame.DataFrame