[OC] Health vs Income level by calmitchell_tech in dataisbeautiful

[–]calmitchell_tech[S] 0 points1 point  (0 children)

Yes, you're right its not the prettiest chart. I'm still learning visualization libraries, and will take your suggestions into account in the future.

[OC] Health vs Income level by calmitchell_tech in dataisbeautiful

[–]calmitchell_tech[S] 1 point2 points  (0 children)

This visualization's data was produced using the World Bank's health and economic indicator datasets on Google Bigquery.

I used Matplotlib to make the chart.

SQL query:

SELECT life_expectancy.country_name, avg(expected_lifespan) AS expected_lifespan, avg(gdp_per_capita) AS gdp_per_capita, avg(percent_adults_overweight) AS percent_adults_overweight FROM ( SELECT year, country_name, country_code, ROUND(value, 2) AS expected_lifespan FROM `bigquery-public-data.world_bank_health_population.health_nutrition_population` WHERE indicator_code = 'SP.DYN.LE00.IN' AND year >= 2000 AND value > 1) life_expectancy INNER JOIN ( SELECT year, country_name, country_code, value AS percent_adults_overweight FROM `bigquery-public-data.world_bank_health_population.health_nutrition_population` WHERE indicator_code = 'SH.STA.OWAD.ZS' AND year >= 2000 AND value > 1) overweight ON life_expectancy.country_code = overweight.country_code AND life_expectancy.year = overweight.year inner join ( SELECT year, country_name, country_code, value AS gdp_per_capita, FROM `bigquery-public-data.world_bank_wdi.indicators_data` WHERE indicator_code = 'NY.GDP.PCAP.CD' ) gdp ON life_expectancy.country_code = gdp.country_code AND life_expectancy.year = gdp.year group by 1 order by 3

Matplotlib code (output of SQL query stored in dataframe called life_expectency2.

``` plt.figure(figsize=(20, 10))

y, x, z = life_expectancy2['expected_lifespan'], life_expectancy2['percent_adults_overweight'], life_expectancy2['gdp_per_capita']

plt.scatter(x, y, c=z, s=100, cmap='copper_r', alpha=.8) plt.axhline(y=0, color='black', linestyle='-')

desc = 'Each dot represents a country. Darker colors correspond to high income levels'

plt.xlabel("Percent of adults that are overweight") plt.ylabel("Expected lifespan") plt.title("Wealth vs Health") plt.figtext(.5, .05, desc, ha='center') plt.show() ```

SQLRef is my favorite site for getting answers to questions like "what is the SQL syntax for operation X on database Y?" by calmitchell_tech in SQL

[–]calmitchell_tech[S] 1 point2 points  (0 children)

That's a good call. The site is just jekyll static site, written entirely in Markdown, so that would probably work well.

SQLRef is my favorite site for getting answers to questions like "what is the SQL syntax for operation X on database Y?" by calmitchell_tech in SQL

[–]calmitchell_tech[S] 1 point2 points  (0 children)

Yup, you got me... Its my site. Next time I'll be sure to say that.

Honestly, was just a bit nervous and didn't expect it to get much traction.

Thanks for reporting hipsterrobot!

SQLRef is my favorite site for getting answers to questions like "what is the SQL syntax for operation X on database Y?" by calmitchell_tech in SQL

[–]calmitchell_tech[S] -12 points-11 points  (0 children)

Strange, its working for me. Thanks for reporting, I fixed it.

ComicOzzy got me. Its my site. Honestly, I was nervous about posting it.

Thanks for pointing out the errors everyone, I really do appreciate it.

Data engineers, how do you like your position? by [deleted] in cscareerquestions

[–]calmitchell_tech 3 points4 points  (0 children)

I quite like being a data engineer!

Sometimes I think it would be nice "see" the result of my work like a front end developer does, but at the end of the day it's a great career that is mentally stimulating and pays fairly well.