Created
June 17, 2019 07:49
-
-
Save ken333135/6d7fa3da4955353eec3b1d37f78c85b7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def date_generator(from_date,to_date): | |
while from_date<=to_date: | |
yield from_date | |
from_date = from_date + dt.timedelta(days=1) | |
# create a new df with 2 columns | |
# col1 : Title, col2: DateRead | |
Title = [] | |
Date = [] | |
for index,row in booksv2.iterrows(): | |
date_temp = list(date_generator(row['Start'],row['End'])) | |
title_temp = [row['Title']]*len(date_temp) | |
print(date_temp,title_temp) | |
Title += title_temp | |
Date += date_temp | |
booksv2 = pd.DataFrame(np.array([Title,Date]),index=['Title','Date']).T |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment