Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

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 #227: /*comments*/

binuacs
21 - Polaris

solution attached

JamesCharnley
13 - Pulsar
Spoiler
JamesCharnley_0-1654377856517.png

 

Wish I had the intelligence suite to try out the text analytics but I'll settle for the fun parse!

davidhardister
8 - Asteroid

davidhardister_0-1657313750477.png

 

CHarrison
8 - Asteroid

My solution :)

James_Driver9
8 - Asteroid
Spoiler
James_Driver9_0-1658492727919.png

 

ARussell34
8 - Asteroid

Yay to comments and charting!

mgaronson
11 - Bolide
Spoiler
mgaronson_0-1660768779419.png

Chose poorly in parsing out subject instead of topic view href. Switched it and all fell into place.

Regex is useful in parsing data. Learning more about regex challenge-by-challenge.

acarter881
12 - Quasar

Here's my solution. I'm uploading the Alteryx workflow, but the parsing happens in Python.

Spoiler
import pandas as pd
import warnings
from bs4 import BeautifulSoup
from tqdm import tqdm

warnings.filterwarnings("ignore", category=UserWarning, module='bs4')

class Challenges:
    def __init__(self, xl_path: str) -> None:
        self.features = 'html.parser'
        self.xl_path = xl_path
        self.body_parsed = list()

    def parse_xl(self) -> pd.DataFrame:
        self.df = pd.read_excel(io=self.xl_path)

        for i in tqdm(range(len(self.df['body']))):
            try:
                soup = BeautifulSoup(markup=self.df['body'][i], features=self.features)
                self.body_parsed.append(soup.text)
            except TypeError:
                self.body_parsed.append('')

        self.df['body_parsed'] = self.body_parsed
        self.df = self.df.drop(columns=['topic view href', 'body'])
 
        return self.df

    def to_pandas(self) -> None:
        self.df = self.df.applymap(lambda x: x.encode('unicode_escape').decode('utf-8') if isinstance(x, str) else x)

        df = pd.DataFrame(data=self.df, index=None)

        df.to_excel(
            excel_writer='my_test_227.xlsx', 
            sheet_name='227', 
            freeze_panes=(1,0),
            index=False
            )

# Instantiate class and call functions
if __name__ == '__main__':
    c = Challenges(xl_path='./challenge_227.xlsx')
    c.parse_xl()
    c.to_pandas()
ahsanaali
11 - Bolide

See solution attached.

Brian32
8 - Asteroid

Challenge Solution:

Spoiler
Brian32_0-1663853914345.png