In [1]:
import pickle
import pandas as pd
import numpy as np
import random
from matplotlib import pyplot as plt

In [2]:
%matplotlib notebook

In [38]:
results = pd.read_csv('/media/128G/bathhacked/BANES_Historic_Car_Park_Occupancy.csv', engine='c', parse_dates=['LastUpdate'], dayfirst=True)

In [45]:
results.reset_index()
results['LastUpdate2'] = results['LastUpdate']
results = results.set_index('LastUpdate')
results = results.sort_index()

In [46]:
results[results['Name'] == "Odd Down P+R"]['Occupancy'].plot()


Out[46]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f1a7e01ac88>

In [49]:
def hr_func(ts):
    return ts.hour

results['time_hour'] = results['LastUpdate2'].apply(hr_func)

In [48]:
def day_of_month(ts):
    return ts.day

results['day_of_month'] = results['LastUpdate2'].apply(day_of_month)

In [52]:
results[results['day_of_month'] == 12.0].groupby('Name').mean()


Out[52]:
Capacity Occupancy Percentage Easting Northing day_of_month time_hour
Name
Avon Street CP 629.232718 127.287731 20.187477 374884.0 164469.0 12.0 11.660876
Charlotte Street CP 1056.000000 311.643561 29.499609 374445.0 165097.0 12.0 11.638711
Lansdown P+R 888.324786 147.463889 17.810897 373183.0 168104.0 12.0 11.682051
Newbridge P+R 666.022517 203.617411 30.517290 371853.0 165766.0 12.0 11.682147
Odd Down P+R 1252.000000 270.039348 21.549857 373363.0 161610.0 12.0 11.486800
Podium CP 521.000000 180.204827 34.090010 375109.0 165083.0 12.0 11.473014
SouthGate General CP 719.970268 223.368429 30.610728 375115.0 164421.0 12.0 11.506973
SouthGate Rail CP 140.000000 67.892107 48.092720 375083.0 164424.0 12.0 11.506973

In [ ]: