Want to get involved? We're always looking for ideas and content for Weekly Challenges.
SUBMIT YOUR IDEAVery basic exercise: Here's my - very straight-forward - take on this.
In looking at the posted solution I probably could have eliminated a few superfluous steps, but here it is:
Update on previous post here: https://community.alteryx.com/t5/Weekly-Challenge/Challenge-206-Hotel-Reservations/m-p/547969#M38582
(forgot to put some detail about the solution)
def rowFunc(row):
arrivalDate = '{}-{}-{}'.format(row.arrival_date_year, row.arrival_date_month, row.arrival_date_day_of_month)
row.arrivalDate = datetime.strptime(arrivalDate, '%Y-%B-%d')
row.departureDate = datetime.strptime(row.reservation_status_date, '%Y-%m-%d')
row.stayTime = (row.departureDate - row.arrivalDate).days
return row
dfInput = dfInput.apply(rowFunc, axis = 1)