Index.get_level_values(self, level)
[source]
Return an Index of values for requested level.
This is primarily useful to get an individual level of values from a MultiIndex, but is provided on Index as well for compatibility.
Parameters: |
|
---|---|
Returns: |
|
See also
MultiIndex.get_level_values
For Index, level should be 0, since there are no multiple levels.
>>> idx = pd.Index(list('abc')) >>> idx Index(['a', 'b', 'c'], dtype='object')
Get level values by supplying level
as integer:
>>> idx.get_level_values(0) Index(['a', 'b', 'c'], dtype='object')
© 2008–2012, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/0.25.0/reference/api/pandas.Index.get_level_values.html