index dataframe column code example
Example 1: define a column as index pandas
myDataFrame.set_index('column_name')
Example 2: pandas print index
# Import pandas package
import pandas as pd
# making data frame
data = pd.read_csv("data.csv")
print(data.index)
Example 3: indexing column in pandas
In [10]: type(titanic[["Age", "Sex"]])
Out[10]: pandas.core.frame.DataFrame