Some coders like it hot — but most prefer colder climates

Previously we found some of the major concentration of open source coders around pretty cold places (Iceland, Sweden, Norway…). The question we want to solve today: Do programmers really prefer colder countries?

Open source coders per capita. Source: https://medium.com/@hoffa/github-top-countries-201608-13f642493773
#standardSQL
SELECT *, ROUND((fahr_avg-32)*5/9, 2) celsius_avg
FROM (
SELECT country, COUNT(DISTINCT stn) stations, ROUND(AVG(temp), 2) fahr_avg
FROM `bigquery-public-data.noaa_gsod.gsod2016` a
JOIN `bigquery-public-data.noaa_gsod.stations` b
ON a.stn=b.usaf AND a.wban=b.wban
GROUP BY country
)
ORDER BY stations DESC
Average temperature per weather station for each country. Source: NOAA GSOD data in BigQuery. Interactive chart!

Data and queries:

#standardSQL
SELECT a.country, temp, ratio_unique_login, continent
FROM (
SELECT c.country, ROUND(AVG(temp),2) temp, COUNT(DISTINCT stn) stations, ANY_VALUE(continent) continent
FROM `bigquery-public-data.noaa_gsod.gsod2016` a
JOIN `bigquery-public-data.noaa_gsod.stations` b
ON a.stn=b.usaf AND a.wban=b.wban
JOIN `gdelt-bq.extra.countryinfo2` c
ON b.country=c.fips
GROUP BY 1
HAVING stations >= 10 OR c.country='Singapore'
) a JOIN (
SELECT c.country, ANY_VALUE(c.population) population
, 10000*COUNT(DISTINCT login)/ANY_VALUE(c.population) ratio_unique_login
FROM `githubarchive.month.201608` a
JOIN `ghtorrent-bq.ght_2017_04_01.users` b
ON a.actor.login=b.login
JOIN `gdelt-bq.extra.countryinfo2` c
# http://download.geonames.org/export/dump/readme.txt
ON LOWER(c.iso)=b.country_code
WHERE country_code != '\\N'
AND population > 300000
AND a.type='PushEvent'
GROUP BY 1
) b
ON a.country=b.country
ORDER BY 3 DESC

Update 1: Is there a relationship with GDP?

Next steps

Data Cloud Advocate at Snowflake ❄️. Originally from Chile, now in San Francisco and around the world. Previously at Google. Let’s talk data.