Sum across rows

killed_manual_sum = killed.iloc[:,:3].sum(axis=1)

For slide 2, What I expected to happen:
I thought axis=0 is for rows, and axis=1 is for columns… Why are we using axis=1 when we are calculating the sums across rows in this case?
I thought it would have been this: killed_manual_sum = killed.iloc[:,:3].sum(axis=10)

When you set your axis to '0' it will fall into below error as your both dataframe as not equal. So, we run the sum function column wise. As you have mentioned this iloc[:,:3] it would go into every row and do the sum column wise.

Here’s a small example to demonstrate this (which only applied to DataFrames, not Series, until Pandas 0.19 where it applies to both):

df1 = pd.DataFrame([[1, 2], [3, 4]])

df2 = pd.DataFrame([[3, 4], [1, 2]], index=[1, 0])

df1 == df2
Exception: Can only compare identically-labeled DataFrame objects