{ "cells": [ { "cell_type": "code", "execution_count": 18, "metadata": { "ExecuteTime": { "end_time": "2017-05-24T15:13:43.919016Z", "start_time": "2017-05-24T16:13:43.760433+01:00" }, "collapsed": true }, "outputs": [], "source": [ "import pandas as pd\n", "from matplotlib import pyplot as plt\n", "from IPython.display import display\n", "%matplotlib inline\n", "plt.rcParams['figure.figsize'] = (20.0, 10.0)\n", "\n", "rhi_csv = 'tabula-RHI-beneficiaries-non-domestic-individuals-companies.csv'\n" ] }, { "cell_type": "code", "execution_count": 30, "metadata": { "ExecuteTime": { "end_time": "2017-05-24T15:17:13.882070Z", "start_time": "2017-05-24T16:17:13.811741+01:00" }, "collapsed": false }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
CompanyPostcodeTypeCapacity (kWth)DateCash
0Aaron NewellBT39Solid Biomass Boiler60.02015-09-0419084.69
1Acheson & Glover Precast LtdBT75Solid Biomass Boiler99.02015-11-0627600.66
2Acheson & Glover Precast LtdBT75Solid Biomass Boiler99.02015-11-0630507.19
3Acheson & Glover Precast LtdBT75Solid Biomass Boiler99.02015-11-0634416.23
4Acheson & Glover Precast LtdBT75Solid Biomass Boiler99.02015-07-1350543.44
\n", "
" ], "text/plain": [ " Company Postcode Type \\\n", "0 Aaron Newell BT39 Solid Biomass Boiler \n", "1 Acheson & Glover Precast Ltd BT75 Solid Biomass Boiler \n", "2 Acheson & Glover Precast Ltd BT75 Solid Biomass Boiler \n", "3 Acheson & Glover Precast Ltd BT75 Solid Biomass Boiler \n", "4 Acheson & Glover Precast Ltd BT75 Solid Biomass Boiler \n", "\n", " Capacity (kWth) Date Cash \n", "0 60.0 2015-09-04 19084.69 \n", "1 99.0 2015-11-06 27600.66 \n", "2 99.0 2015-11-06 30507.19 \n", "3 99.0 2015-11-06 34416.23 \n", "4 99.0 2015-07-13 50543.44 " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/plain": [ "Company object\n", "Postcode object\n", "Type object\n", "Capacity (kWth) float64\n", "Date datetime64[ns]\n", "Cash float64\n", "dtype: object" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "df = pd.read_csv(rhi_csv)\n", "df['Date'] = pd.to_datetime(df['Date of\\rApplication'], format='%d/%m/%Y')\n", "df['Cash'] = df['Amount of payments\\rmade to 28 February\\r2017 (£)*'].replace('[£,]','', regex=True).astype(float)\n", "df.drop(['Date of\\rApplication','Amount of payments\\rmade to 28 February\\r2017 (£)*'], axis=1, inplace=True) \n", "df.rename(columns={'Business or\\rInstallation\\rLocation':'Postcode', 'Installation\\rCapacity\\r(kWth)':'Capacity (kWth)','Technology Type':'Type','Name':'Company'}, inplace=True)\n", "display(df.head())\n", "display(df.dtypes)" ] }, { "cell_type": "code", "execution_count": 36, "metadata": { "ExecuteTime": { "end_time": "2017-05-24T15:18:46.613887Z", "start_time": "2017-05-24T16:18:46.574273+01:00" }, "collapsed": false }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
CompanyPostcodeTypeCapacity (kWth)DateCash
1157NaNNaN(GSHP)NaNNaTNaN
\n", "
" ], "text/plain": [ " Company Postcode Type Capacity (kWth) Date Cash\n", "1157 NaN NaN (GSHP) NaN NaT NaN" ] }, "execution_count": 36, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df[df.Postcode.isnull()]" ] }, { "cell_type": "code", "execution_count": 37, "metadata": { "ExecuteTime": { "end_time": "2017-05-24T15:19:09.762112Z", "start_time": "2017-05-24T16:19:09.744219+01:00" }, "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "60295840.10000002" ] }, "execution_count": 37, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df.Cash.sum()" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "anaconda-cloud": {}, "kernelspec": { "display_name": "Python [conda root]", "language": "python", "name": "conda-root-py" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.5.3" }, "latex_envs": { "bibliofile": "biblio.bib", "cite_by": "apalike", "current_citInitial": 1, "eqLabelWithNumbers": true, "eqNumInitial": 0 }, "nav_menu": {}, "toc": { "navigate_menu": true, "number_sections": true, "sideBar": true, "threshold": 6, "toc_cell": false, "toc_section_display": "block", "toc_window_display": false } }, "nbformat": 4, "nbformat_minor": 2 }