I have the following graph produced by the code below:

from pandas import *
from ggplot import *
plot = ggplot(data, aes('x','y')) \ #from dataframe 'data', columns x and y
+ geom_bar(stat='bar', fill='blue') + ggtitle('Graph of X and Y') \
+scale_x_continuous(name="X-Axis", breaks=[0, 4, 8, 12, 16, 20, 23], \
labels=["Midnight", "4:00am", "8:00am", "12:00pm","4:00pm","8:00pm","11:00pm"])\
+ylab("Y-Axis") + xlim(0, 23)
print plot
The variable represented by y is a count of the number of events per hour over a period of several weeks. I want to examine the average number of events hourly instead of the total number of events hourly over that time period.
How do I graph the average of 'y' instead of just plotting 'y' using ggplot in Python?
Thanks!
EDIT:
So, I suppose what I really need is a way to get the avg y events per hour (x). Currently, when I try to do so, I return a graph with equal values across all hours.