I’m getting confused with using the iloc [ ] slicing. In the course it states that using iloc the ending slice is not included. Here is the question and URL link its asking me to complete:
" Assign the first five rows of the
null_previous_rank dataframe to the variable
top5_null_prev_rank by choosing the correct method out of either
Since the ending slice is not included, I thought the answer would be
top5_null_prev_rank = null_previous_rank.iloc[:6]
The right answer:
top5_null_prev_rank = null_previous_rank.iloc[:5]
Why is this? I’m trying to wrap my head around this. If anyone can help, greatly appreciate it!
Please pardon me being straightforward, this way of studying is less effective than one can be.
It shows that the student is writing code in large chunks before doing a single run at the end, with the hopes of getting the correct answer/passing a checker, but not developing the skill to investigate, debug, go beyond what is asked of to do something in an alternative/simpler/better way.
Ideally, the goal of exercises should be to learn how a tool behaves, with skeleton code provided to save the student setup time, while the student tweaks the tool parameters and inputs in all ways possible to understand it’s behaviour.
So 1 way to do this is do print your results and see for yourself what do you get when you do
In software engineering this is called testing. Knowing what cases to use is a skill to develop in itself. For now i’m trying to expose a way of learning that allows the student to discover more for himself than what the lesson can provide.
Thank you for the input and advice. I’ll get to it!