Skip to content

Instantly share code, notes, and snippets.

@nim4n136
Last active January 13, 2020 18:05
Show Gist options
  • Save nim4n136/24f1a3c3f4fed8a91bbcccc15a99beac to your computer and use it in GitHub Desktop.
Save nim4n136/24f1a3c3f4fed8a91bbcccc15a99beac to your computer and use it in GitHub Desktop.
Date range pandas python montly
from datetime import datetime
import pandas as pd
def date_object(string):
return datetime.strptime(string, '%Y-%m-%d')
start = date_object('2019-01-01')
end = date_object('2020-01-12')
list = pd.date_range(start, end, freq=pd.DateOffset(months=1))
list = pd.date_range(start, end, freq=pd.DateOffset(weeks=1))
print(list)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment