{ "cells": [ { "attachments": {}, "cell_type": "markdown", "metadata": { "colab_type": "text", "id": "view-in-github" }, "source": [ "# ML/Random Forest Classifier: Weather Prediction\n", "[Click here to Interact with this code on nbViewer](https://nbviewer.org/github/ujwalnk/MachineLearning101/blob/main/docs/examples/Machine_Learning_02_Weather_Classfication.ipynb)\n", "## Data Preprocessing" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "id": "5BZOlBpsIrkw" }, "outputs": [], "source": [ "import pandas as pd" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": { "id": "k3cQdermJkB9" }, "source": [ "Get the `csv` from github" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 386 }, "id": "DuU9kyr-JlT6", "outputId": "12acf768-802d-40e2-a0a5-b2441f728318" }, "outputs": [ { "data": { "text/html": [ "\n", "
\n", " | Date | \n", "Location | \n", "MinTemp | \n", "MaxTemp | \n", "Rainfall | \n", "Evaporation | \n", "Sunshine | \n", "WindGustDir | \n", "WindGustSpeed | \n", "WindDir9am | \n", "... | \n", "Humidity9am | \n", "Humidity3pm | \n", "Pressure9am | \n", "Pressure3pm | \n", "Cloud9am | \n", "Cloud3pm | \n", "Temp9am | \n", "Temp3pm | \n", "RainToday | \n", "RainTomorrow | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "2008-12-01 | \n", "Albury | \n", "13.4 | \n", "22.9 | \n", "0.6 | \n", "NaN | \n", "NaN | \n", "W | \n", "44.0 | \n", "W | \n", "... | \n", "71.0 | \n", "22.0 | \n", "1007.7 | \n", "1007.1 | \n", "8.0 | \n", "NaN | \n", "16.9 | \n", "21.8 | \n", "No | \n", "No | \n", "
1 | \n", "2008-12-02 | \n", "Albury | \n", "7.4 | \n", "25.1 | \n", "0.0 | \n", "NaN | \n", "NaN | \n", "WNW | \n", "44.0 | \n", "NNW | \n", "... | \n", "44.0 | \n", "25.0 | \n", "1010.6 | \n", "1007.8 | \n", "NaN | \n", "NaN | \n", "17.2 | \n", "24.3 | \n", "No | \n", "No | \n", "
2 | \n", "2008-12-03 | \n", "Albury | \n", "12.9 | \n", "25.7 | \n", "0.0 | \n", "NaN | \n", "NaN | \n", "WSW | \n", "46.0 | \n", "W | \n", "... | \n", "38.0 | \n", "30.0 | \n", "1007.6 | \n", "1008.7 | \n", "NaN | \n", "2.0 | \n", "21.0 | \n", "23.2 | \n", "No | \n", "No | \n", "
3 | \n", "2008-12-04 | \n", "Albury | \n", "9.2 | \n", "28.0 | \n", "0.0 | \n", "NaN | \n", "NaN | \n", "NE | \n", "24.0 | \n", "SE | \n", "... | \n", "45.0 | \n", "16.0 | \n", "1017.6 | \n", "1012.8 | \n", "NaN | \n", "NaN | \n", "18.1 | \n", "26.5 | \n", "No | \n", "No | \n", "
4 | \n", "2008-12-05 | \n", "Albury | \n", "17.5 | \n", "32.3 | \n", "1.0 | \n", "NaN | \n", "NaN | \n", "W | \n", "41.0 | \n", "ENE | \n", "... | \n", "82.0 | \n", "33.0 | \n", "1010.8 | \n", "1006.0 | \n", "7.0 | \n", "8.0 | \n", "17.8 | \n", "29.7 | \n", "No | \n", "No | \n", "
5 rows × 23 columns
\n", "RandomForestClassifier()In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
RandomForestClassifier()