Plotting categorical data over time in Python

牧云@^-^@ 提交于 2020-03-03 11:41:06

问题


I have a data set as follows:

[Time of notification], [Station], [Category]
2019-02-04 19.36:22, Location A, Alert
2019-02-04 20.06:35, Location B, Request
2019-02-05 07.04:53, Location A, Incident

Time of notification is in datetime64[ns] format. The time span is one year.

I am trying to get the following line graphs:

  • One per station
  • Time on x axis. Preferably: Accumulated for days of the week and hours (e.g. all Mondays, Tuesdays etc together, so that a daily/weekly trend over the whole year becomes visible).
  • Number of notifications (for that station) on the y axis. Category is irrelevant.

I have tried a lot, but I am new to time series and to visualization, and I am getting nowhere after hours of trying. I have been trying with plt.subplots, value_counts etcetera. Also tried making this graph for one station first, but even that didn't work out.

Can anyone help?

Thank you!

来源:https://stackoverflow.com/questions/60056073/plotting-categorical-data-over-time-in-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!