简体   繁体   中英

Getting Date range in pandas

Let's say I want to get a date range having start and end date

I have implemented something like this:

from datetime import date
start = date("2012-01-15")
end = date("2012-09-20")
pd.date_range(start, end, freq='M').shift(15, freq=pd.datetools.day)

But I am getting an Error:

TypeError: an integer is required (got type str)

The datetime module does not recognize strings, convert them into integers, in the format of date( year , month , day )

start = date(2012, 1, 15)
end = date(2012, 9, 20)

Edit: lose the 0 for single digits

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM