-2

I want to create a df which includes every day in 2019 July that looks like this:

      datetime
0   2019-07-01 00:00:00
1   2019-07-02 00:00:00
2   2019-07-03 00:00:00
3   2019-07-04 00:00:00
... 

What is the best way to do it?

nilsinelabore
  • 4,143
  • 17
  • 65
  • 122
  • 1
    try pd.date_range('2019-07-01','2019-07-31',freq='D') – sammywemmy Feb 18 '20 at 01:34
  • Does this answer your question? [Creating a range of dates in Python](https://stackoverflow.com/questions/993358/creating-a-range-of-dates-in-python) – AMC Feb 18 '20 at 02:38

1 Answers1

0

IIUC

m = '2019-07'
period = pd.Period(m, freq='M')
df = pd.DataFrame()
df['Date'] = pd.date_range(start=period.start_time, end=period.end_time, freq='D')
BENY
  • 317,841
  • 20
  • 164
  • 234