title: How to Count and Plot Interval Time Series Data (Hourly) in Python)?
body: <p>I have accident Time Series data (YYYY-MM-DD HH:MM:SS. I can count all the data based on weekday, year, hour, but I am trying to to count between 8 and 17 hours. Also, want to plot and show the counted numbers range as 8-10, 10-12, 12-13, 13-15, 15-17.</p>
  
  <p>My codes;</p>
  
  <pre><code>df = pd.read_excel("C:/Users/gokhankazar/Desktop/Accident Times/Accident_Time-Series.xlsx")
  df["Hour"] = df.Datetime.dt.hour
  df.Hour.value_counts().sort_index().plot(marker='o', linestyle='-')
  plt.xlabel('Hours', fontsize=10)
  plt.ylabel("Number of Accident", fontsize= 10)
  plt.show()
  </code></pre>
  
  <p>And I got plot figure as below
  <a href="https://i.stack.imgur.com/hTxY8.png" rel="nofollow noreferrer">My figure that I got</a></p>
  
  <p>But how can I change my axis range in plot figure.</p>
  
  <p>Also I have weekdays figure as like
  <a href="https://i.stack.imgur.com/uUeDO.png" rel="nofollow noreferrer">WeekDay figure</a></p>
  
  <p>I want to write on x axis Monday instead of "0" and Sunday instead of "6" with all other days</p>
  
  <p>my Datetime column as (total 268000 rows) and just counting the accident event based on time series data </p>
  
  <pre><code>18.05.2015  09:00:00
  18.05.2015  15:00:00
  18.05.2015  14:14:00
  18.05.2015  09:00:00
  .
  .
  .
  </code></pre>