Weekly Challenges

Solve the challenge, share your solution and summit the ranks of our Community!

Also available in | Français | Português | Español | 日本語
IDEAS WANTED

Want to get involved? We're always looking for ideas and content for Weekly Challenges.

SUBMIT YOUR IDEA

Challenge #206: Hotel Reservations

SeanAdams
17 - Castor
17 - Castor

Solution attached below - both in regular Alteryx and embedded Python.

 

Spoiler
Results.pngSolution.png
TonyAdam
8 - Asteroid

Some logical sorting of the result would have been useful... 

 

Spoiler
tonyadam_0-1585432542929.png

 

reply_mueller
8 - Asteroid

Very basic exercise: Here's my - very straight-forward - take on this.

Spoiler
AlteryxGui_2020-03-29_01-18-57.png

 

ponraj
13 - Pulsar

Here is my solution. 

 

Spoiler
Capture.PNG
BradWerner
11 - Bolide
Spoiler
206_Complete.png
CesarPicco
7 - Meteor

This one was fun and timely too...  

MOHAMMEDAFZAL
7 - Meteor

Here's my solution. The Alteryx version was not compatible so used a blank workflow.

 

Check it out!

 

Thanks 🙂

estherb47
15 - Aurora
15 - Aurora

Fun and fast! 

 

Spoiler
EstherB47_0-1585623615882.png

 

Steph3388
7 - Meteor

In looking at the posted solution I probably could have eliminated a few superfluous steps, but here it is:

 

Spoiler

 

Steph3388_0-1585691231883.png

 

 

SeanAdams
17 - Castor
17 - Castor

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)

 

Spoiler

The Python version uses many of the same techniques as any DataFrame project:

DataFrame Fitering
dfInput = dfInput[dfInput['reservation_status'] == 'Check-Out']

new column based on a function based on other columns.
- Helper function
- Do an apply with the axis set to 1 (rows rather than columns)

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)


Then some summarising - thanks to @NicoleJohnson  for showing me how to do this
dfGrouped = dfInput.groupby(['arrival_date_month']).stayTime.agg([np.mean, np.count_nonzero])

#SnakingMyWayThruChallenges