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 #332: The more ice cream, the better!

nkinsey
8 - Asteroid
Spoiler
nkinsey_0-1661028746545.png

 

What about Breyers?!

PhilipMannering
16 - Nebula
16 - Nebula

My attempt at doing it in the Python Tool,

 

Spoiler
PhilipMannering_0-1661030235434.png

 

import pandas as pd
from ayx import Alteryx
df = Alteryx.read('#1')


#################################
rows = (~df.ingredients.isna()) & (df.brand != 'breyers')
cols = ['brand', 'name', 'rating', 'ingredients']
df = df.loc[rows, cols]


#################################
rename_brand = {'bj': "Ben and Jerry's", 'hd': "Häagen-Dazs", 'talenti': 'Talenti Gelato'}
df['brand'] = df.brand.map(rename_brand)


#################################
df.rating = df.rating.astype(float)


#################################
df.groupby('brand').mean().sort_values('rating', ascending=False)


#################################
def filter_allergens(df):
    '''Get all the ice cream without allergens cream and peanuts'''
    mask = ~df.ingredients.str.contains('cream|peanuts', case=False)
    return (
        df.loc[mask]
        .drop(columns='rating')
        .rename(columns=lambda col:col.title())
        .reset_index(drop=True)
    )

filter_allergens(df)


#################################
def get_best_and_worst(df):
    return (
        df.sort_values('rating')
        .groupby('brand')
        .agg(('first', 'last'))
        .rename(columns={'first':'Worst', 'last':'Best', 'name':'Ice Cream'})
        .rename(columns=lambda col:col.title())
        .swaplevel(0, 1, axis=1)
        .sort_index(axis=1)
    )

get_best_and_worst(df)

 

TapasTR
7 - Meteor

Here's my solution. Good one to brush up the knowledge of some tools not used since long.

 

Spoiler
Challenge 332_Spoiler.jpg
amosteller
7 - Meteor

amosteller_0-1661106171460.png

 

SeanMc_Westpac
5 - Atom

Solution #332.PNG

kelvin_law1
9 - Comet

Here is my solution:

Spoiler
kelvinlaw_0-1661135184979.png

 

Reesetrain2
9 - Comet

All,

Spoiler
My submission:
1 Find/Replace
2 Joins
1 Multi Join
Capture.PNG

DanFlint
8 - Asteroid
Spoiler
DanFlint_0-1661172613159.png

 

FloSchoch
7 - Meteor
Spoiler
FloSchoch_0-1661172919753.png

 

Brando
7 - Meteor

All that alteryx work makes me hungry for ice cream. I personally like cookie dough at Andy's, a local ice cream shop in the Kansas City metro!