The sum() Method with Pandas Series
Explore how the sum method operates on pandas Series, especially when dealing with NaN values and data type conversions. Understand pandas' approach to missing data, the behavior of integer and float types, and how to avoid common bugs in your calculations.
We'll cover the following...
We'll cover the following...
Try it yourself
Try executing the code below to see the result.
Explanation
There are a few things going on in this teaser. The first has to do with the // operator in
out = v1 // v2. This is the
In [1]: 7/2
Out[1]: 3.5
In [2]: 7//2
Out[2]: 3
The // operator is useful when we want to calculate indices (for example, in a binary search).
The next odd thing is that we managed to divide by ...