Data Visualization - Guided Project: Finding Heavy Traffic Indicators on I-94

Dear Friends! Today I’d like to share with you another guided project: Finding Heavy Traffic Indicators on I-94! I personally enjoyed the data visualization part of the course so far very much and I’m looking forward to the next missions! Any suggestions are more than welcomed. Happy coding!!! :slight_smile:

https://app.dataquest.io/m/524/guided-project%3A-finding-heavy-traffic-indicators-on-i-94/10/next-steps

DQ Project 4 - Heavy Traffic Indicators.ipynb (214.3 KB)

Click here to view the jupyter notebook file in a new tab

1 Like

Greetings @witoldstupnicki

I have been looking at your work and something has caught my attention, check that what I say is true because I can be wrong. :lying_face:

When you visualize the day and night graphs in cell 12, the axes refer on one side to the traffic volume and on the other side to the frequency. Seems odd.

If you make a histogram, which is what you do when you call plt.hist() at the bottom, what you do is to apply a table of frequencies grouped thanks to the use of the series.

When you set the condition between day and night in cell 9, I would say that it does not work properly

This is what I did:

night_bool = (traffic['date_time'].dt.hour >=19) | (traffic['date_time'].dt.hour <=7)

horas_nighttime = traffic.loc[night_bool,'date_time'].dt.hour
horas_nighttime.unique()

array([19, 20, 21, 22, 23,  0,  1,  2,  3,  4,  5,  6,  7])

I hope I have not made a mistake.
I show you what I have done so that you have another point of view.

plt.figure(figsize = (15,4))

plt.subplot(1,2,1)

plt.hist(horas_daytime)
plt.xlabel('Day hours from 7 AM to 7 PM ')
plt.ylabel('Cars per hour')
plt.title('Traffic Volume: Day')

plt.subplot(1,2,2)

plt.hist(horas_nighttime)
plt.xlabel('Night hours from 7 PM to 7 AM')
plt.ylabel('Cars per hour')
plt.title('Traffic Volume: Night')

plt.show()

I send you my best regards and I hope I have helped you more than anything else.

A&E

1 Like

Thanks! This looks compelling. :slight_smile:

Give me a shout if you have a problem.

A&E