I’m working through this
https://app.dataquest.io/c/54/m/292/exploring-data-with-pandas%3A-intermediate/6/working-with-integer-labels
I knew the right answer but tried to use .head()
instead. Is there a reason to choose one over the other? They both seem to create dataframes.
- Assign the first five rows of the
null_previous_rank
dataframe to the variabletop5_null_prev_rank
by choosing the correct method out of eitherloc[]
oriloc[]
.
My Code:
# My Answer
top5_null_prev_rank = null_previous_rank.head(5)
# Course answer
top5_null_prev_rank = null_previous_rank.iloc[:5]