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 #195: XML Parsing

Jotigautam
10 - Fireball
Spoiler
Jotigautam_0-1658227990980.png

 

Probably a solution different from What I normally do, but happy to have another way!

 

ahsanaali
11 - Bolide

See solution attached.

JalenBraegelmann
8 - Asteroid

Great challenge that tests knowledge on all of the xml configuration options.

ncrlelia
11 - Bolide

Challenge 195

harrame
8 - Asteroid
8 - Asteroid

I don't know much about XML so I didn't wind up using the XML parse tool - just took a whack at it

Spoiler
harrame_0-1661800634121.png

 

grazitti_sapna
17 - Castor

Used XML parser

grazitti_sapna_0-1661942493806.png

 

Sapna Gupta
CodeMonkey
8 - Asteroid

10-line python solution, not counting imports and comments

Spoiler

from ayx import Alteryx
import pandas as pd
import xml.etree.ElementTree as ET

text = Alteryx.read("#1").iloc[0]['xml']
# "element tree" structure useful for XML / HTML
tree = ET.fromstring(text)

data = []
#walk through each taxon node
nodes = tree.findall('.//taxonpath')

for e in nodes:
source = e.findall('./source/langstring')[0].text
ent_text = e.findall('./taxon/entry/langstring')[0].text
data.append({'name':source,'value':ent_text})

df = pd.DataFrame(data)
Alteryx.write(df,1)

acarter881
12 - Quasar

Here's my solution.

Spoiler
my_weekly_challenge_195_solution.png
martinding
13 - Pulsar
Spoiler
195.png

danlsn
7 - Meteor

Solved!