On Day 3 of Dashboard Week, we were tasked with scraping crime data for cities worldwide from Numbeo. We also needed to supplement our analysis with another dataset from the site. I chose the quality of life dataset because it provides a holistic view of factors that might impact crime rates.

Data Preparation in Alteryx

It had been a while since I did web scraping, so I made a few mistakes initially, but eventually, I created the workflow successfully. I wanted to include regional and subregional aspects to visualize and analyze crime rates across different parts of the world, such as Asia, Africa, and Western Europe. After extracting distinct countries from the dataset, I used ChatGPT to provide regional data, which I then joined with the crime dataset.

Upon importing the data into Tableau, I noticed that not all cities in the crime index dataset were present in the quality of life dataset. For visualization purposes, I decided to handle them separately, creating a new flow to merge the data and include regions and subregions again. One challenge was the site’s hidden HTML elements, which prevented me from scraping the city rankings directly. I used the TILE tool to create rankings but found the variability too high for effective visualization, so I reverted to my original workflow and dataset.

Visualization in Tableau

I had ambitious visualization ideas, as sketched below. I envisioned a world map view for each region, showing clickable countries inspired from this viz here, categorizing indexes into low, medium, and high, and displaying the percentage of countries in each category. I also planned to create a scatter plot of crime index versus quality of life index, a histogram of index medians, and a ranking performance chart for the best and worst cities over time.

 

Due to time constraints, I adapted my approach and created the following report which you can view in Tableau Public here.

The scatter plot shows regions lining up in quadrants. Generally, countries with high quality of life had low crime rates, such as those in Western Europe and Oceania (e.g., Australia). Northern America had an average crime index but high quality of life. Many Asian regions had low quality of life but also low crime indexes. The Caribbean and South Africa regions had high quality of life but also high crime indexes. African countries, Central Asia, and South America had high crime indexes and low quality of life.

Kuala Lumpur, Malaysia, showed the highest improvement in rankings, jumping from 11th to 2nd in crime index, and significantly improved its quality of life. Although its ranking dropped among other cities, it remains one of the safest with a good quality of life.

 

 

Prerana Amatya
Author: Prerana Amatya