Get entire days timestamp with secs in python

Question:

I need to trying to get entire days timestamp in array. I need from 00:00:00 to 24:00:00 seconds of timestamp a day i.e 86400 data.

I have used pandas to achieve but could not

m_days=1
# today's date in timestamp
base = pd.Timestamp.today()

timestamp_list = [base + datetime.timedelta(days=x) for x in range(n_days)]
Asked By: suhas_rkms

||

Answers:

This should do it then:

import pandas as pd

start = pd.Timestamp('2022-02-16')  # start of the day
end = start + pd.Timedelta(days=1)  # end of the day

timestamps = pd.date_range(start, end, freq='s')
Answered By: fallouthase