https://app.dataquest.io/c/54/m/289/introduction-to-numpy/12/calculating-statistics-for-2-d-ndarrays
# we'll compare against the first 5 rows only
taxi_first_five = taxi[:5]
# select these columns: fare_amount, fees_amount, tolls_amount, tip_amount
fare_components = taxi_first_five[:,9:13]
fare_sums = fare_components.sum(axis=1)
fare_totals = taxi_first_five[:,13]
print(fare_totals)
print(fare_sums)
How come the output is the same
taxi_firs-five is selecting the first 5 rows and 13th column, which is total
fare_components is selecting all 4 rows and adding up
but the output is the same; I did not understand that part
How come output is both 5 rows, because fare_components has all rows
Output
[ 69.99 54.3 37.8 32.76 18.8]
[ 69.99 54.3 37.8 32.76 18.8]