I have a Pandas DataFrame with a named index. I want to pass it off to a piece off code that takes a DataFrame, a column name, and some other stuff, and does a bunch of work inv
You could also use df.index.get_level_values if you need to access a (index) column by name. It also works with hierarchical indices (MultiIndex).
df.index.get_level_values
MultiIndex
>>> df.index.get_level_values('name') Index(['a', 'b', 'c', 'd', 'e'], dtype='object', name='name')