Sign In

Gold Vs Sp500 Eda

Has Gold been a Good Investment Over Stock Market?

An Exploratory Data Analysis project to compare Gold vs S-P 500 index


Image source :


In this article we are going to analyze historical prices of Gold and S&P 500 index are try to find some useful insides using Exploratory Data Analysis (EDA).

Disclaimer: The purpose of this article is only to demonstrate the EDA techniques with comparative analysis of Gold & S&P 500, This is not the investment advice.

What is EDA?

Exploratory Data Analysis (EDA) is the process of exploring, investigating and gathering insights from data using statistical measures and visualizations. The objective of EDA is to develop and understanding of data, by uncovering trends, relationships and patterns.

EDA is both a science and an art. On the one hand it requires the knowledge of statistics, visualization techniques and data analysis tools like Numpy, Pandas, Seaborn etc. On the other hand, it requires asking interesting questions to guide the investigation and interpreting numbers & figures to generate useful insights.

What is the S&P 500?

The S&P 500 is a market-capitalization-weighted stock market index that tracks the stock performance of about 500 of some of the largest U.S. public companies.

Investors and economists use the S&P 500 as a benchmark for the overall U.S. stock market and the U.S. economy as a whole. The S&P 500 is a key economic indicator because it largely reflects investors' collective expectations for the future, unlike other economic data that reflect economic conditions in the present or recent past. When investors or economists discuss the performance of the U.S. "stock market," they commonly refer to the S&P 500 as a shorthand. Thats the reason I am using 'S&P 500' to represent US stock market and we will do comparative analysis against Gold.

How to run the code

You can execute the code using "Google Colab" or "Run Locally"

The code is available on Github:

Setup and Tools

Run on Colab :
You will need to provide the Google login to run this notebook on Colab.

Run Locally : Download and install Anaconda framework, We will be using Jupyter Notebook for writing & executing code.

Outline of Project

Here is the outline of the project

  • Import and Install the required libraries
  • Download real-world dataset
  • Perform data Preprocessing & cleaning
  • Perform Exploratory analysis & Visualization
  • Ask and answer Interesting questions about the data
  • Summarize your inferences & write a conclusion

Import and Install the required libraries

Fist step is to to install & Import required Python Libraries

Vinod Dhole6 months ago