Skip to content

Instantly share code, notes, and snippets.

@alhoqbani
Last active September 20, 2019 16:14
Show Gist options
  • Select an option

  • Save alhoqbani/41063f5f67218c8ca75a29c016b99901 to your computer and use it in GitHub Desktop.

Select an option

Save alhoqbani/41063f5f67218c8ca75a29c016b99901 to your computer and use it in GitHub Desktop.

Udacity DAND Project 01

Outline:

  1. Collecting data from Udacity workspace:

An sql query was run to collect data from the database. The query was designed to join temps data from Riyadh city (My choice) and the global temps.

SELECT g.year, c.avg_temp AS riyadh_avg_temp, g.avg_temp AS global_avg_temp
FROM global_data g
RIGHT JOIN city_data c ON g.year = c.year
WHERE c.city = 'Riyadh' AND c.avg_temp IS NOT NULL;

The query also eliminates any null values in the data as it will affect calculating the moving average.

  1. Importing data into Google Spreadsheets.

The data was imported to Google Spreadsheets and can be found at this link

  1. Calculating the moving average:

For both Riyadh and Global data a 10-year moving average was calculated.

The moving average was calculated using Google Spreadsheets by adding an extra columns next to Riyadh data and the global data. Then, we started from the 11th row and calculate the average for the past 10 years. Finally, the formula was copied to all subsequent rows.

  1. Line Chart

A line chart was inserted visualizing both global and Riyadh data in the same chart.

Observations:

  1. At a glance, we can definitely tell that weather in Riyadh is much hotter than the reset of the world. During the period covering the observed data, Riyadh temperature was over 24 and the global temperature was below 10.

  2. Both trends show a steady increase in the temperature. However, temperature readings in Riyadh show a more rapid increase since the year 2000.

  3. Overall, the temperature readings in Riyadh fluctuated while Globalreadings have more steady increments.

  4. The charts show some correlation between the increase in Global readings the the readings from Riyadh. For example, we can see that between 1850 and 1900 there some increase in both at the same time. The same applies to the readings after year 2000 where both have quicker increase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment