Hi all! I have 2 questions about below boolean code. I try to understand the logic here…
-The first line of code is to take out the pickup month column.
-The second line is to compare the value in the pickup column to 1. I try to print the january_bool here, the output is [ True True True … False False False]
-The 3rd line means…? for my understanding, we try to assign some values of pickup_month column to the variable January. For example,in the last few lessons,we did B=A[3], the code means that we store the values at the A row index 3 position to the B. It has to be a specific number inside to identify the position. but here, we put [january_pool] which is [ True True True … False False False], so how can it get the output?
-The 4th line, i understand the .shape function, but what [0] means?
Thank you!!!
code:
pickup_month = taxi[:,1]
january_bool = pickup_month == 1
january = pickup_month[january_bool]
january_rides = january.shape[0]