On which day there's more trips by taxis in the city of New York?

Hi every one
I had just finished h=the Boolean Indexing with numpy mission
at the end of the mission, I want to answer this question
On which day there are more trips by taxis in the city of New York?
to answer this question I will try to use the frequency table

rip_mph = taxi[:,7] / (taxi[:,8] / 3600)
cleaned_taxi = taxi[trip_mph < 100, :] # cleaning the data
day_fq ={} # create empty  dictionary,
import datetime as dt 
for row  in   cleaned_taxi:
    dt_data = dt.datetime(int(row[0]), int(row[1]), int(row[2]))
    day = dt_data.strftime( "%A") # covert day to string
    if day not in day_fq:
        day_fq[day] = 1
        day_fq[day] += 1
day_fq_list = []  #create empty lists to sort the frequency table
for day in day_fq:
    day_fq_list.append([day_fq[day], day])
day_fq_sorted = sorted(day_fq_list, reverse = True) # sort the frequency table

And the answer is

[[14911, 'Monday'],
 [14189, 'Thursday'],
 [13541, 'Friday'],
 [12828, 'Sunday'],
 [12782, 'Wednesday'],
 [12758, 'Tuesday'],
 [8401, 'Saturday']]

if you have any remark to improve the code or maybe another method using boolean indexing please let me know.

Hi Ahmed,

Nice work on coming up with a solution to this question. Exploring your ideas like this is such an effective way to learn, so I applaud your method!

To give you some feedback on the code, the approach here isn’t a very “NumPy” way of doing things, as you have used loops rather than vectorized methods. That said, for the task you’re doing, it’s reasonably cumbersome to achieve in a vectorized way using just NumPy.

Later on in this course, you’re going to learn how to use the pandas library, which is built on top of NumPy (which is why we teach NumPy first) and provides a lot more functionality for common data analysis tasks.

In pandas, there is support for vectorized date operations, and that will help you approach this problem in a vectorized manner. Once you complete our pandas content (there’s a few courses worth), you might like to circle back on this problem and see how you would achieve it based on your new skills.

I hope this is helpful feedback to you!

Thank you @joshdq for the feedback, I will work on this problem again once I complete the pandas course.