{ "cells": [ { "cell_type": "markdown", "metadata": { "collapsed": false }, "source": [ "
\n", "Option to toggle code visibility on/off is at bottom of page.
" ] }, "execution_count": 1, "metadata": { }, "output_type": "execute_result" } ], "source": [ "from IPython.display import display, HTML\n", "HTML('''Note:Option to toggle code visibility on/off is at bottom of page.
''')" ] }, { "cell_type": "markdown", "metadata": { "collapsed": false }, "source": [ "Next, we must load the CSV file into a dataframe, making sure that any extra spaces are skipped." ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ ], "source": [ "import warnings\n", "warnings.simplefilter('ignore', FutureWarning)\n", "\n", "from pandas import *\n", "chester = read_csv('Chester_2015.csv', skipinitialspace=True)" ] }, { "cell_type": "markdown", "metadata": { "collapsed": false }, "source": [ "## Cleaning the data\n", "First we need to clean up the data. \n", "\n", "This involves: \n", "- renaming `'WindDirDegrees< br />'` to `'WindDirDegrees'`, if required; \n", "- removing the `< br />` html line breaks from the values in the `'WindDirDegrees'` column;\n", "- and changing the values in the `'WindDirDegrees'` column to `float64`." ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ ], "source": [ "chester = chester.rename(columns={'WindDirDegrees\n", " | GMT | \n", "Max TemperatureC | \n", "Mean TemperatureC | \n", "Min TemperatureC | \n", "Dew PointC | \n", "MeanDew PointC | \n", "Min DewpointC | \n", "Max Humidity | \n", "Mean Humidity | \n", "Min Humidity | \n", "... | \n", "Max VisibilityKm | \n", "Mean VisibilityKm | \n", "Min VisibilitykM | \n", "Max Wind SpeedKm/h | \n", "Mean Wind SpeedKm/h | \n", "Max Gust SpeedKm/h | \n", "Precipitationmm | \n", "CloudCover | \n", "Events | \n", "WindDirDegrees | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
GMT | \n", "\n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " |
0 rows × 23 columns
\n", "