I have a single date:
Data_raw = "08/09/20 21:05"
How can i generate a list of dates (type=str) included in an interval of +-40 minutes? Please note that I have already tried the following code:
Data = datetime.strptime(Data_raw,'%d/%m/%y %H:%M')
a = Data
c = a + timedelta(minutes=40)
b = a - timedelta(minutes=40)
Upper_limit = str(pd.date_range(start=Data, end=c, periods=41))
Lower_limit = str(pd.date_range(start=Data, end=b, periods=41))
Unfortunately when I try to filter a DataFrame with Upper_limit
and Lower_limit
no result is shown.
On the other hand, if the filter is applied with the string (Data_raw
) the DataFrame is succesfully filtered.
Thanks