This repository contains a Python script that performs data visualization on sea level rise using the Pandas and Matplotlib libraries. The script reads sea level data from a CSV file, creates a scatter plot with lines of best fit, and visualizes the rise in sea levels over time.
- Introduction
- Table of Contents
- Code Description
- Key Points / Learning
- Applicability
- How to Use
- Contributing
- Initial Contributor
The Python script performs the following tasks:
-
Imports necessary libraries:
pandas
,matplotlib.pyplot
, andscipy.stats.linregress
. -
Reads sea level data from a CSV file using Pandas.
-
Creates a scatter plot with sea level data points.
-
Calculates and plots the line of best fit using all data from 1880 to 2050.
-
Calculates and plots the line of best fit using data from the year 2000 onwards.
-
Adds labels, title, and legend to the plot.
-
Saves the plot as an image file and returns the plot object.
-
Data Visualization: The script showcases the use of Matplotlib library for creating visualizations.
-
Line of Best Fit: The script demonstrates how to calculate and plot lines of best fit for the sea level data.
-
Data Analysis: The script calculates and visualizes the rise in sea levels over time using linear regression.
This code is applicable in scenarios where you need to visualize and analyze sea level rise data to observe trends and patterns. Potential areas of application include:
-
Climate Research: Analyzing historical sea level data to study climate change and its impact.
-
Environmental Monitoring: Visualizing sea level rise for regions vulnerable to coastal flooding.
-
Educational Purposes: Demonstrating the use of linear regression and data visualization in educational contexts.
To visualize and analyze sea level rise data using this script, follow these steps:
-
Clone the repository to your local machine using
git clone https://github.com/Mabdullahatif/SeaLevel_Predictor.git
. -
Download the dataset file
epa-sea-level.csv
and place it in the repository directory. -
Open the Jupyter Notebook or Google Colab environment.
-
Navigate to the repository directory.
-
Open the
main.py
file. -
Run the code cells to perform data visualization and analysis and view the generated plot.
Contributions are welcome! To contribute to the Sea Level Predictor, follow these steps:
-
Fork the repository.
-
Create a new branch for your feature or bug fix.
-
Make your changes and commit them with descriptive commit messages.
-
Push your changes to your forked repository.
-
Create a pull request detailing your changes and explaining their purpose.
Please make sure to follow the repository's code of conduct and guidelines.
So far, all the work in this repository is purely done by me.