Visualizing URL structure with a treemap

URL Structure

See how a website is structured by seeing how much each folder represents in terms of URLs

  • Provide a lit of URLs
  • Set height, width, and theme (optional)
  • Determine the number of items per level
  • “See” the website

Read a list of URLs from a text/CSV file

Code
import advertools as adv
import adviz
import pandas as pd
from pathlib import Path
import os
if os.getcwd().endswith('/nbs'):
    filepath = 'data/apple_url_list.csv'
else:
    filepath = 'nbs/data/apple_url_list.csv'
apple = pd.read_csv(filepath)
apple.head(10)
url
0 https://www.apple.com/ae/shop/accessories/all
1 https://www.apple.com/ae/shop/accessories/all/accessibility
2 https://www.apple.com/ae/shop/accessories/all/airtag
3 https://www.apple.com/ae/shop/accessories/all/beats
4 https://www.apple.com/ae/shop/accessories/all/beats-featured
5 https://www.apple.com/ae/shop/accessories/all/cases-protection
6 https://www.apple.com/ae/shop/accessories/all/creativity
7 https://www.apple.com/ae/shop/accessories/all/displays-mounts
8 https://www.apple.com/ae/shop/accessories/all/drones
9 https://www.apple.com/ae/shop/accessories/all/headphones-speakers

Visualize the URL structure with

adviz.url_structure(apple['url'])

Number of values per level

adviz.url_structure(
    url_list=apple['url'],
    items_per_level=5)

Number of values per level

adviz.url_structure(
    url_list=apple['url'],
    items_per_level=25)

Pick a theme

adviz.url_structure(
    url_list=apple['url'],
    items_per_level=25,
    theme='plotly_dark')

Pick a theme

adviz.url_structure(
    url_list=apple['url'],
    items_per_level=15,
    theme='seaborn')

Set domain name and chart title

Code
adviz.url_structure(
    url_list=apple['url'],
    items_per_level=15,
    theme='ggplot2',
    domain='apple.com',
    title='URL Structure: <b>apple.com</b><br>Raw data: <a href="data/apple_url_list.csv">Apple.com URLs</a>')

Get started now:





python3 -m pip install adviz


Explore more advertools data visualizations