Q. Trying to extract the first five rows of DataFrame x, Nia has given code as:
x.loc[0:5]
Bur it is returning 6 rows. Why ? Suggest the answer :-
Answer :-
It is returning 6 rows because loc does not produce output like slices. It includes both starting and end point. To correct the above problem, Nia needs to change the code to :
x. loc [0:4]
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )