Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

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 #56: Parsing and Counting Hashtags

jarrod
ACE Emeritus
ACE Emeritus

tough one in python, pretty straight forward in Alteryx though 🙂

Spoiler
jarrod_1-1592404672182.png
from ayx import Alteryx
import pandas as pd
import numpy as np

data = Alteryx.read('#1')
data['hashtags'] = data['text'].str.findall('(#\w+)').astype(str).str.replace('[','').str.replace(']','').str.replace("'",'')

data = pd.concat([pd.Series(row['id_str'], row['hashtags'].split(','))              
                    for _, row in data.iterrows()]).reset_index()

data = data.rename(columns={'index':'hashtags', 0:'id_str'})
data['hashtags'] = data['hashtags'].str.replace(' ','')
data = data[data['hashtags']!=u'']
data = pd.crosstab(data.hashtags, data.id_str).reset_index()

data

#SnakingMyWayThruChallenges

JonathanW
8 - Asteroid

Solved!

 

Spoiler
JonathanW_0-1592543871667.png

 

chinedu
7 - Meteor

my solution

dougperez
12 - Quasar

My solution!

Spoiler

dougperez_0-1593782153808.png

 

Blake
12 - Quasar
Spoiler
56.png
iamme012397
8 - Asteroid

no need for parsing formula

jaschirmer
7 - Meteor

Here's my solution.

alynnreau
8 - Asteroid
Spoiler
alynnreau_0-1597187648734.png

 

FlorianC
Alteryx
Alteryx

Interesting to see all the different approaches to solve this challenge.

 

Spoiler
WorkflowWorkflow
Florian Carrier
Strategic Solution Consultant
Alteryx
JethroChen
10 - Fireball
Spoiler
challenge_56_jc.PNG