Learn practical skills, build real-world projects, and advance your career

Global Warming affects on Agriculture - India

Global Warming and Agriculture are the two of the many things which always excites me, and I'm always curious about it. So why not collab both under the same roof.

Global Warming can be the next biggest global crisis after the current COVID-19 pendamic. It has been affecting the agriculture around the world and will more in future. So in this data analysis we'll analyze - how does the global warming affects the agriculture.

Contents

  • How to run the code
  • Data Preparation and Cleaning
  • Exploratory Analysis and Visualization
  • Asking and Answering Questions
  • Inferences and Conclusion
  • References and Futher readings

How to run the code

This is an executable Jupyter notebook hosted on Jovian.ml, a platform for sharing data science projects. You can run and experiment with the code in a couple of ways: using free online resources (recommended) or on your own computer.

Option 1: Running using free online resources (1-click, recommended)

The easiest way to start executing this notebook is to click the "Run" button at the top of this page, and select "Run on Binder". This will run the notebook on mybinder.org, a free online service for running Jupyter notebooks. You can also select "Run on Colab" or "Run on Kaggle", but you'll need to create an account on Google Colab or Kaggle to use these platforms.

Option 2: Running on your computer locally

  1. Install Conda by following these instructions. Add Conda binaries to your system PATH, so you can use the conda command on your terminal.

  2. Create a Conda environment and install the required libraries by running these commands on the terminal:

conda create -n zerotopandas -y python=3.8 
conda activate zerotopandas
pip install jovian jupyter numpy pandas matplotlib seaborn opendatasets --upgrade

  1. Press the "Clone" button above to copy the command for downloading the notebook, and run it on the terminal. This will create a new directory and download the notebook. The command will look something like this:
jovian clone notebook-owner/notebook-id

  1. Enter the newly created directory using cd directory-name and start the Jupyter notebook.
jupyter notebook

You can now access Jupyter's web interface by clicking the link that shows up on the terminal or by visiting http://localhost:8888 on your browser. Click on the notebook file (it has a .ipynb extension) to open it.

Data Preparation and Cleaning

Lets now, talk a little about data prepartions and cleaning. For this analysis I've used various datasets from kaggle. The main focus of the dataset is to analyze and visualize the impact on agriculture of global warming.

I've used to different datasets - one for global temperatures and other for the indian crop production datasets. After preparing the datasets at the end this topic I got made data frames india_temp_df and india_crop_production_df and saved it as and .csv file.

Activities Performed
  • Load the dataset into a data frame using Pandas
  • Explore the number of rows & columns, ranges of values etc.
  • Handle missing, incorrect and invalid data
  • Perform any additional steps (parsing dates, creating additional columns, merging multiple dataset etc.)
import os
os.listdir()
['india-temp.csv',
 'india-crop-production.csv',
 '.ipynb_checkpoints',
 'cropProduction',
 '.jovianrc',
 'cropProduction.zip',
 'global-temperatures.csv',
 'GlobalLandTemperaturesByState.csv',
 'GlobalLandTemperaturesByState.csv.zip',
 'global warming affects on agriculture India.ipynb']
import pandas as pd