I have a dataframe of number of messages and the time period they were sent in (increments of 10 minutes). Here's a snippet:
+---------------------+--------------+
| UnixTime | Num messages |
+---------------------+--------------+
| 2019-02-01 00:00:00 | 54 |
| 2019-02-01 00:10:00 | 23 |
| 2019-02-01 00:20:00 | 36 |
+---------------------+--------------+
This dataframe has a year's worth of increment timestamps and the number of messages in that period. How can I model a mean/median week using the entire dataframe and as the day of week as a reference.
+-----------------+-------------------------+
| UnixTime (Mean) | Mean number of messages |
+-----------------+-------------------------+
| Friday 00:00:00 | 56.3 |
| Friday 00:10:00 | 25.5 |
| Friday 00:20:00 | 30.4 |
+-----------------+-------------------------+
So the output dataframe should model an average week from Monday-Sunday for the year, with the number of messages averaged over the year for that time period and day.
I know I can get the day of the week by df["Day Of Week"] = df['UnixTime'].dt.day_name() but how can I model the average so that each Monday of the year between 09:00 - 09:10 is treated as the same group for example.
grouby. You should be able to do something like:df.groupby('Day Of Week').mean(). - Collin PhillipsMean number of messagesin your dataframe all have the same value? - Erfan00:00 - 00:10is treated as the same group? - Erfan