Skip to content

Tag: datetime

Deleting rows based on time interval in pandas

I have a dataframe with datetime timestamps (every 1 minute). I’d like to increase the time interval between rows to 5 minutes. Basically keep rows 0, 5, 10 etc and remove the rest. How would I do that? Thanks Answer Firstly convert your date column to datetime dtype by using to_datetime() method(If its…

Multiple dates in a pandas column

I am trying to make the dates in a Pandas DataFrame all of the same format. Currently I have the DataFrame storing the dates in two formats. “6/08/2017 2:15:00 AM” & 2016-01-01T00:05:00 The column name which these dates are stored under is INTERVAL_END. As you can see, one of the dates is a st…

selecting the row with given datetime index

There are 2 datasets I wanna use to find the evaluation score which data_pred , data_test First of all, the data_test is the data that is used to check the accuracy which looks like this the data_pred is got from ARIMA prediction which looks ​like this The reason I can’t find the MSE score between these…

Creating date range pairs in pandas

I have two datetimes between which I would like to generate regular intervals of 4 hours (excluding the last interval, which can be less than 4 hours if there are less than 4 hours between the previous timestamp and end). I am stuck on interval generation with pandas.date_range, which only returns the end tim…

Pandas groupby datetime columns by periods

I have the following dataframe: I would like to get for each row (e.g a,b,c,d …) the mean vale between specific hours. The hours are between 9-15, and I want to groupby period, for example to calculate the mean value between 09:00:00 to 11:00:00, between 11- 12, between 13-15 (or any period I decide to)…