Add VT2-examples: all 6 chapters of 'Visualize This' (110 files) — data scraping, ETL, trends, categorical, multivariate, spatial, distribution analysis

This commit is contained in:
neo committed 2026-06-24 14:49:15 +05:00
1 parent 088771a9cf
commit b42b866a8c
110 files changed
+400895

No files matched your search

@@ -0,0 +1,20 @@
from bs4 import BeautifulSoup
fields = None
with open('income-scraped-to-xml.xml') as xmlfile:
xmlread = xmlfile.read()
soup = BeautifulSoup(xmlread, features='xml')
# Start file
f = open('xml-back-to-csv.csv', 'w')
# Write rows to file
f.write(",".join(['famindex', 'AGE', 'FTOTINC'])+'\n')
rows = soup.findAll('row')
for row in rows:
f.write(','.join([row.famindex.string, row.AGE.string, row.FTOTINC.string])+'\n')
# Close file
f.close()