I'm just wondering if I can do something like:
df.loc['1990':'2000']
by doing something like:
my_slice = '1990':'2000'
df.loc[my_slice]
What I've written doesn't work, but is there something similar that does?
I'm just wondering if I can do something like:
df.loc['1990':'2000']
by doing something like:
my_slice = '1990':'2000'
df.loc[my_slice]
What I've written doesn't work, but is there something similar that does?
Yes, but you don't write slices like that. You write
slice('1900', '2000', None)
instead.