JerBouma
2/12/2019 - 1:31 PM

[Locate a Range within a DataFrame] A range within a Dataframe.

[Locate a Range within a DataFrame] A range within a Dataframe.

# Copy DataFrame
df2 = df.copy()

# Set the Index
df2 = df2.set_index('Edition')

# Select Year Range
df2 = df2.loc[2004:2012]

# Further filter your data (two methods)
df2 = df2[(df2['Athlete'] == 'PHELPS, Michael')]
df2 = df2.loc[df2['Athlete == 'PHELPS, Michael')]