I have data for a whole year with an interval of fifteen minutes and want to create a histogram counting hours and not fifteen minutes.
Toy example code
I have following toy example code
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
df = pd.read_csv(r"D:/tmp/load.csv")
df.hist(bins=range(20,80,5))
sns.set()
plt.xlabel("Value")
plt.ylabel("count")
plt.show()
Which produces the following graph.
The data within the DataFrame is of the form:
>>> df[(df["Time"] > "2021-04-10 19:45:00") & (df["Time"] < "2021-04-10 21:00:00")]
Time tag
9584 2021-04-10 20:00:00 50.3840
9585 2021-04-10 20:15:00 37.8332
9586 2021-04-10 20:30:00 36.6808
9587 2021-04-10 20:45:00 37.1840
Expected result
I need to change the y-axis values on the histogram so as to see the hours count and not the fifteen minutes count. So for the first column I should see 10 (40/4) instead of 40. So the whole y-axis should be divided by 4.
Question
How can I perform the scaling of the y-axis in the histogram?
Should I work with plt.yticks
function somehow?