I have a for loop looping all my rows and include columns start and end dates, then another loop within the first loop which takes the range between my dates, so that it takes everyday in my ranges. I need to make a new df which show everyday in these ranges and keeps the rest of my columns.
ID Name Manager Client Start End Rate
5123 O Kin D Jam P Diddy 2-1-2019 6-6-2019 100
1234 D Rus A Gio P Diddy 3-4-2018 4-7-2019 100
3456 R Asd G Nee P Diddy 1-1-2018 5-5-2019 150
6643 M Ben C Gee Tupeeee 3-3-2019 4-5-2019 120
The purpose of this is that when i import to power bi, My original dataset only shows start and end dates, so i cannot filter. I need to be able to to import the entire date range or perhaps the unique of it?(help) so that i can filter out month, day, year. My bus_days below shows 12000 days workdays and i only have 50 rows. Should i import with the rest of my columns or as a date dataframe? These are my required columns: Index(['ID', 'Name', 'Manager', 'Client, 'Days', 'Holidays', 'Rate']
for i, row in df.iterrows():
busdays = []
start = pd.to_datetime(df['Start_Date'][i])
end = pd.to_datetime(df['End_Date'][i])
holidays = df['Holidays'][i]
df['days'][i] = workdays(start, end, holidays)
reve[i] = day[i] * rate[i]
reve[i] = rev[i]*df['Percentage'][i]//100
day_range = pd.bdate_range(start, end)
for day_ in day_range:
date_str = datetime.datetime(day_.year, day_.month, day_.day, 0,
0)
date_str = day_.strftime('%m, %d, %Y')
date_ = datetime.datetime.strptime(date_str, "%m, %d,
%Y").date()
busdays.append(date_str)
I need:
ID Name Manager Client Date Rate
0 5123 O Kin D James P Diddy 2-1-2019 100
1 5123 O Kin D James P Diddy 3-1-2019 100
2 5123 O Kin D James P Diddy 4-1-2019 150
3 5213 O Kin D James P Diddy 5-1-2019 120
i have: the dates for everyday, ie. busdays(work days) from the code
I need: the rest of the columns: ID Name Manager Client Date Rate
Random dates in my code are start and end dates ranging from 01- 01-2018 to 31-12-2019. Total busdays i have is around 12000 from an initial dataset of 50 rows. I need to fill up other columns to match the dates Any suggestions will be appreciated.