In dataframe I have an index from column Nation.
But I can't do
df[df.Nation.str.startswith('U')]
without reseting index.
How can I get str object of index?
In dataframe I have an index from column Nation.
But I can't do
df[df.Nation.str.startswith('U')]
without reseting index.
How can I get str object of index?
Use
index
which works withstr
nice:Sample:
If need select by
level
ofMultiIndex
useget_level_values
: