Q. Can you specify the reason behind the output produced by the code statements of question Given below?
Given are two objects, a list object namely Ist1 and a Series object namely
Answer :-
The reason behind the output produced by statement (i) is that:
When some scalar value is multiplied with a list object, then the list is replicated those many times, thus the result is having the list elements repeated twice.
The reason behind the output produced by statement (ii) is that:
When some scalar value is multiplied with a Series object, then the given operation gets performed on every single element of the Series because for a Series, the operations are carried in a vectorized way, i.e., applied on each element one by one.
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )