the most confusing part of this exercise was trying to understand how everyone else got to their solution and seeing the answer to include one of the steps being
killed_manual_sum = killed.iloc[:,:3].sum(axis=1)
vs
killed_manual_sum = killed[['pedestrians_killed', 'cyclist_killed', 'motorist_killed']].sum(axis=1)
and everything is okay now but when I first saw iloc
being used I had a minor freak out that I don’t intuitively know anything at all about selecting data.
comparing the two statements together and checking the .value_counts()
assures that they’re definitely kind-of-maybe-sort-of-perhaps similiar but why did I just immediately think of this and everyone else, plus the question-builders thought of iloc
instead? Will this be a problem for me in the future? Is this even remotely the same thing or would this have sent me flying off into the wrong direction?
Thanks.
p.s.
please let me know if i have labeled/tagged this incorrectly/inefficiently and how I can do better.