Course Name: Python for Trading: Basic, Section No: 8, Unit No: 17, Unit type: Quiz
I think the correct answear for this quiz is letter "C" instead of letter "A".
Hi Gabriel,
In '.loc' slicing, you specify the name of the index to slice the df and in the question, '4' is not an integer location for the index. Instead, it is the name of the index. To understand better, consider slicing a data frame of which indexes are dates, and in this case, instead of 4, you need to use the exact date in '.loc'. That's why the answer is 'A'. During slicing, it includes the one you specify within '.loc'.
Instead of '.loc', if we used '.iloc', then the correct answer would be 'C'.
Hope this helps.