This file will have more deadheading analysis

At least at the beginning I'll be looking at busruns that are 50% plus deadheading


In [1]:
import pandas as pd
schedule = pd.read_csv('../data/UW_Trip_Data_4mo_QC_capacity.csv')
dh_data = pd.read_csv('../data/4mo_deadhead_results.csv')


//anaconda/lib/python2.7/site-packages/IPython/core/interactiveshell.py:2717: DtypeWarning: Columns (3) have mixed types. Specify dtype option on import or set low_memory=False.
  interactivity=interactivity, compiler=compiler, result=result)
Subset data and attempt to fix the run type issue (still doesn't work)

In [2]:
fiftiers = dh_data[dh_data.PctDeadhead > .5]
fiftiers['Run'] = fiftiers['Run'].astype('str')


/anaconda/lib/python2.7/site-packages/ipykernel/__main__.py:2: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  from ipykernel import kernelapp as app
lamba function to get the number of actions each bus run in fitiers has

In [3]:
def getLenRuns(date, run):
    print(date)
    print(run)
    return(len(schedule[(schedule.ServiceDate == date) & (schedule.Run == run)]))

In [4]:
numActions = fiftiers.apply(lambda x: getLenRuns(x.ServiceDate, x.Run), axis=1)
numActions


0015-01-01
9711
0015-01-01
9713
0015-01-01
9730
0015-01-01
8710
0015-03-07
999R
0015-03-08
999R
0015-04-18
999R
0015-04-19
999R
0015-04-25
999R
0015-04-26
999R
0015-04-02
700LD
0015-04-30
700LD
0015-01-01
PEB1
0015-02-01
PEB1
0015-01-13
680SEB
0015-02-05
680SEB
0015-02-23
680SEB
0015-03-05
680SEB
0015-04-06
680SEB
0015-03-04
180SEB
0015-04-02
180SEB
0015-04-29
180SEB
0015-03-16
181SEB
0015-04-14
181SEB
0015-04-08
184SEB
0015-01-08
190TRN
0015-01-09
190TRN
0015-03-06
190TRN
0015-03-24
480SEB
0015-03-17
483SEB
0015-03-27
483SEB
0015-03-17
580SEB
0015-03-27
582SEB
0015-03-12
583SEB
0015-03-27
583SEB
0015-03-27
584SEB
0015-04-02
584SEB
0015-01-13
681SEB
0015-04-30
698LD
0015-03-19
699LD
0015-04-20
699LD
0015-02-12
682SEB
0015-03-16
683SEB
0015-03-17
683SEB
0015-04-01
683SEB
0015-04-06
683SEB
0015-02-05
980SEB
0015-02-23
580BTW
0015-04-21
182SEB
0015-01-03
BD1
0015-01-09
BD1
0015-02-18
BD1
0015-02-20
BD1
0015-02-25
BD1
0015-03-13
BD1
0015-03-31
BD1
0015-04-01
BD1
0015-04-30
BD1
0015-01-26
BD2
0015-02-24
BD2
0015-03-24
BD2
0015-04-01
BD2
0015-04-03
BD2
0015-04-07
BD2
0015-04-30
BD2
0015-01-05
BD3
0015-01-15
BD3
0015-03-03
BD3
0015-03-04
BD3
0015-04-21
BD3
0015-04-28
BD3
0015-03-11
BD4
0015-03-16
BD4
0015-04-20
BD4
0015-04-28
BD4
0015-04-17
BD10
0015-04-17
BD11
0015-01-23
BD20
0015-02-05
BD20
0015-02-19
BD20
0015-03-02
BD20
0015-03-16
BD20
0015-02-26
BD21
0015-04-02
BD21
0015-04-17
BD21
0015-02-25
PEB20
0015-04-13
PEB20
0015-04-01
PEB21
0015-02-26
PEB22
0015-03-01
PEB10
0015-02-23
PEB12
0015-02-18
PEB2
0015-02-23
PEB2
0015-03-25
PEB2
0015-04-08
PEB2
0015-01-19
PEB3
0015-01-26
PEB3
0015-03-04
PEB3
0015-04-06
PEB3
0015-04-21
PEB3
0015-04-10
PEB4
0015-04-28
PEB5
0015-01-19
PEB7
0015-01-16
BD30
0015-01-21
BD30
0015-01-22
BD30
0015-02-05
BD30
0015-02-20
BD30
0015-02-22
BD30
0015-03-21
BD30
0015-03-22
BD30
0015-03-26
BD30
0015-04-15
BD30
0015-04-17
BD30
0015-04-20
BD30
0015-02-20
BD31
0015-02-21
BD31
0015-02-22
BD31
0015-04-21
BD31
0015-01-06
BD32
0015-04-21
BD32
0015-04-21
BD33
0015-01-10
PEB30
0015-01-18
PEB30
0015-02-16
PEB30
0015-03-20
PEB30
0015-04-14
PEB30
0015-04-16
PEB30
0015-04-30
PEB30
0015-01-13
PEB31
0015-02-17
PEB31
0015-03-30
PEB31
0015-04-28
586SEB
0015-02-06
371
0015-01-19
372
0015-02-03
375
0015-02-05
375
0015-02-12
375
0015-01-14
377
0015-01-14
378
0015-02-13
379
0015-04-01
6010
0015-04-06
6010
0015-04-23
6010
0015-04-30
6010
0015-01-06
6013
0015-01-08
6013
0015-02-03
6020
0015-03-02
6020
0015-04-24
6020
0015-04-09
6021
0015-02-16
6023
0015-04-17
6023
0015-04-15
6024
0015-03-16
6030
0015-03-24
6030
0015-04-23
6030
0015-04-29
6030
0015-01-02
6031
0015-02-06
6031
0015-03-25
6031
0015-04-15
6031
0015-03-31
6032
0015-04-27
6032
0015-01-26
6033
0015-03-12
6033
0015-03-18
6033
0015-03-05
6040
0015-04-27
6040
0015-04-17
6050
0015-04-08
6051
0015-04-23
6051
0015-03-19
6052
0015-03-20
6052
0015-01-22
6053
0015-04-13
6053
0015-02-06
6054
0015-04-16
6055
0015-04-28
6057
0015-04-16
6060
0015-04-21
6061
0015-01-20
6062
0015-04-03
6063
0015-03-17
6064
0015-03-25
6064
0015-04-17
6064
0015-03-31
6110
0015-02-05
6112
0015-03-30
6112
0015-03-31
6112
0015-02-19
6113
0015-03-24
6130
0015-03-26
6130
0015-04-16
6130
0015-04-17
6130
0015-03-23
6131
0015-03-30
6131
0015-04-28
6131
0015-04-29
6131
0015-01-05
6132
0015-02-20
6132
0015-01-19
6133
0015-03-30
6133
0015-04-08
6133
0015-01-05
6134
0015-04-29
6134
0015-01-26
6135
0015-02-02
6135
0015-02-25
6135
0015-04-24
6135
0015-04-08
6136
0015-03-25
6150
0015-01-28
6172
0015-02-03
6172
0015-01-07
610SEA
0015-01-15
610SEA
0015-02-16
610SEA
0015-01-14
620WS
0015-02-19
7030
0015-02-19
7031
0015-03-11
7032
0015-01-05
7033
0015-01-30
7034
0015-02-02
7034
0015-02-06
7034
0015-03-13
7034
0015-01-08
7035
0015-02-26
7035
0015-01-09
7036
0015-02-06
7036
0015-03-12
7036
0015-02-20
7120
0015-03-17
7120
0015-04-07
7120
0015-04-22
7120
0015-04-28
7120
0015-01-27
7121
0015-02-24
7121
0015-03-17
7121
0015-04-22
7121
0015-02-17
7122
0015-01-12
7123
0015-01-23
7123
0015-02-10
7123
0015-03-02
7123
0015-01-07
925
0015-01-14
925
0015-01-21
925
0015-02-25
925
0015-03-03
925
0015-03-05
925
0015-03-09
925
0015-03-10
925
0015-03-13
925
0015-03-23
925
0015-03-24
925
0015-03-27
925
0015-03-30
925
0015-04-01
925
0015-04-03
925
0015-04-07
925
0015-04-08
925
0015-04-09
925
0015-04-13
925
0015-04-15
925
0015-04-16
925
0015-04-17
925
0015-04-21
925
0015-04-24
925
0015-04-28
925
0015-01-15
926
0015-02-05
926
0015-02-10
926
0015-03-19
926
0015-03-26
926
0015-03-30
926
0015-04-14
926
0015-01-20
927
0015-02-13
927
0015-03-19
927
0015-03-25
927
0015-04-01
927
0015-04-13
927
0015-04-15
927
0015-04-20
927
0015-04-21
927
0015-04-28
927
0015-03-13
301
0015-02-05
305
0015-03-02
305
0015-01-29
306
0015-02-27
306
0015-02-19
309
0015-03-02
310
0015-01-30
324
0015-02-10
326
0015-01-02
328
0015-01-09
332
0015-02-03
333
0015-02-09
336
0015-02-12
336
0015-02-18
336
0015-02-17
339
0015-02-05
342
0015-03-13
343
0015-01-16
355
0015-01-13
356
0015-03-02
356
0015-01-23
358
0015-02-06
359
0015-02-18
359
0015-02-04
360
0015-02-16
360
0015-03-04
361
0015-01-06
362
0015-01-06
364TRC
0015-02-03
365
0015-03-05
365
0015-03-13
365
0015-04-13
1030
0015-04-24
1030
0015-04-28
1030
0015-02-18
1031
0015-03-16
1031
0015-03-24
1032
0015-04-03
1041
0015-03-16
1050
0015-03-25
1050
0015-04-03
1050
0015-04-24
1050
0015-03-20
1051
0015-03-24
1051
0015-03-09
1053
0015-02-24
1070
0015-02-23
1071
0015-02-03
1072
0015-04-02
1073
0015-01-22
1090
0015-01-28
1091
0015-03-03
1091
0015-03-18
1091
0015-04-15
1092
0015-01-22
1093
0015-01-02
1210
0015-03-20
1210
0015-04-29
1210
0015-01-05
1211
0015-03-20
1211
0015-01-09
1212
0015-01-12
1212
0015-01-20
1212
0015-04-06
1212
0015-04-07
1212
0015-01-09
1231
0015-03-19
1270
0015-03-24
1271
0015-02-10
1272
0015-04-07
1510
0015-04-17
1510
0015-01-14
1511
0015-03-17
1511
0015-03-27
1511
0015-04-27
1512
0015-02-05
1521
0015-02-12
1521
0015-04-23
1521
0015-01-13
1630
0015-01-14
1630
0015-01-16
1630
0015-01-23
1630
0015-01-27
1630
0015-01-29
1630
0015-02-05
1630
0015-03-20
1630
0015-04-23
1630
0015-04-30
1630
0015-01-05
1631
0015-01-09
1632
0015-03-13
1632
0015-03-18
1632
0015-03-20
1632
0015-04-23
1632
0015-03-18
1633
0015-04-22
1633
0015-04-24
1633
0015-04-30
1633
0015-03-18
101R
0015-03-25
101R
0015-04-09
101R
0015-04-17
2010
0015-03-23
2011
0015-04-06
2011
0015-03-26
2012
0015-04-07
2012
0015-04-21
2012
0015-01-02
2013
0015-04-20
2013
0015-04-30
2013
0015-02-02
2014
0015-04-01
2014
0015-01-14
2020
0015-04-27
2020
0015-02-03
2022
0015-03-20
2022
0015-04-17
2022
0015-04-13
2023
0015-01-02
2024
0015-03-23
2024
0015-04-13
2024
0015-04-27
2024
0015-03-18
2025
0015-03-24
2025
0015-03-25
2025
0015-01-12
2051
0015-03-19
2051
0015-03-26
2051
0015-04-02
2052
0015-04-06
2052
0015-04-08
2052
0015-04-09
2052
0015-04-13
2052
0015-04-20
2052
0015-04-23
2052
0015-03-23
2053
0015-03-24
2053
0015-03-26
2053
0015-04-22
2053
0015-04-24
2053
0015-04-28
2053
0015-02-13
2054
0015-03-06
2054
0015-03-23
2054
0015-04-06
2054
0015-04-22
2054
0015-01-09
2060
0015-01-19
2060
0015-02-19
2060
0015-03-09
2060
0015-03-30
2060
0015-03-31
2060
0015-04-08
2060
0015-04-28
2060
0015-01-06
2063
0015-02-04
2063
0015-04-01
2063
0015-04-03
2063
0015-04-08
2063
0015-04-13
2063
0015-01-07
2064
0015-01-16
2064
0015-02-27
2064
0015-03-05
2064
0015-03-10
2064
0015-03-17
2064
0015-03-30
2064
0015-04-03
2064
0015-01-16
2066
0015-01-27
2066
0015-03-06
2066
0015-03-17
2066
0015-03-25
2066
0015-04-02
2066
0015-04-07
2066
0015-04-08
2066
0015-04-21
2066
0015-04-27
2066
0015-01-02
2111
0015-01-13
2111
0015-01-14
2111
0015-02-25
2111
0015-03-06
2111
0015-03-18
2111
0015-03-20
2111
0015-03-23
2111
0015-03-25
2111
0015-04-08
2111
0015-04-10
2111
0015-04-29
2111
0015-03-16
2112
0015-03-20
2112
0015-04-06
2112
0015-03-23
4010
0015-03-24
4010
0015-04-22
4010
0015-01-06
4011
0015-02-05
4011
0015-03-23
4011
0015-04-03
4011
0015-04-08
4011
0015-04-14
4011
0015-04-17
4011
0015-04-22
4011
0015-03-19
4012
0015-04-28
4012
0015-03-25
4013
0015-04-13
4013
0015-04-29
4013
0015-03-19
4020
0015-04-23
4020
0015-04-08
4021
0015-04-16
4021
0015-03-25
4022
0015-04-15
4022
0015-04-29
4022
0015-03-17
4030
0015-03-19
4030
0015-03-23
4030
0015-03-24
4030
0015-03-25
4030
0015-04-16
4030
0015-04-17
4030
0015-04-21
4030
0015-02-19
4031
0015-03-17
4034
0015-04-03
4035
0015-03-18
4050
0015-04-02
4050
0015-04-07
4050
0015-04-13
4050
0015-04-17
4050
0015-04-23
4050
0015-03-25
4051
0015-02-10
4052
0015-04-09
4052
0015-04-21
4052
0015-04-16
4053
0015-04-21
4053
0015-01-27
4055
0015-03-19
4055
0015-03-31
4055
0015-04-13
4055
0015-04-28
4055
0015-03-13
4056
0015-04-14
4056
0015-04-17
4056
0015-03-12
4057
0015-03-16
4062
0015-01-06
4064
0015-03-10
4064
0015-03-17
4110
0015-03-23
4110
0015-03-24
4110
0015-04-03
4110
0015-04-10
4110
0015-04-15
4110
0015-04-29
4110
0015-04-20
4111
0015-03-23
4112
0015-04-02
4112
0015-04-27
4112
0015-04-10
4120
0015-04-13
4121
0015-04-24
4121
0015-03-18
4130
0015-04-06
4130
0015-01-29
4140
0015-02-03
4140
0015-03-20
4140
0015-03-20
4141
0015-04-03
4141
0015-03-24
4142
0015-04-09
4142
0015-01-14
4150
0015-04-24
4150
0015-04-10
4152
0015-04-14
4152
0015-01-14
4153
0015-03-18
4153
0015-03-24
4153
0015-04-08
4153
0015-04-28
4153
0015-03-27
401R
0015-04-27
401R
0015-02-17
402R
0015-03-16
402R
0015-03-17
402R
0015-04-23
402R
0015-04-07
501R
0015-03-20
5012
0015-03-26
5012
0015-01-20
5015
0015-03-20
5030
0015-03-25
5030
0015-04-24
5030
0015-03-26
5031
0015-04-07
5031
0015-04-22
5031
0015-02-25
5032
0015-03-24
5050
0015-03-30
5050
0015-04-15
5050
0015-04-20
5050
0015-03-18
5051
0015-03-25
5051
0015-03-30
5051
0015-04-03
5051
0015-04-06
5051
0015-04-16
5051
0015-03-23
5054
0015-04-07
5054
0015-04-20
5054
0015-04-27
5054
0015-04-01
5055
0015-04-22
5055
0015-01-22
5057
0015-03-31
5070
0015-04-27
5070
0015-01-21
5071
0015-03-23
5071
0015-04-16
5071
0015-03-26
5073
0015-02-04
5075
0015-03-26
5230
0015-03-23
5231
0015-03-24
5231
0015-03-27
5231
0015-04-03
5231
0015-04-10
5231
0015-03-20
5232
0015-01-27
5241TRC
0015-01-29
5241TRC
0015-02-25
5241TRC
0015-04-28
5241TRC
0015-02-26
5520TRC
0015-01-19
5570TRC
0015-01-21
5570TRC
0015-02-06
5570TRC
0015-02-10
5570TRC
0015-01-15
5571TRC
0015-01-30
5572
0015-02-27
5572
0015-01-30
510SHO
0015-02-20
510SHO
0015-03-06
510SHO
0015-03-17
6011
0015-03-31
6011
0015-04-03
6011
0015-04-21
6011
0015-04-23
6011
0015-04-28
6011
0015-01-22
602R
0015-01-30
602R
0015-02-10
602R
0015-03-20
602R
0015-03-27
602R
0015-04-15
602R
0015-04-17
602R
0015-04-24
602R
0015-02-16
601R
0015-02-17
601R
0015-03-17
601R
0015-03-18
601R
0015-03-30
601R
0015-04-02
601R
0015-04-07
601R
0015-04-13
601R
0015-04-20
601R
0015-04-22
601R
0015-04-24
601R
0015-04-27
601R
0015-03-22
915SEB
0015-04-26
918SEB
0015-01-04
997LD
0015-01-17
997LD
0015-01-18
998LD
0015-04-19
987SEB
0015-03-21
988SEB
0015-04-19
989SEB
0015-02-07
979SEB
0015-01-25
984SEB
0015-02-21
9010
0015-04-25
9010
0015-04-11
9015
0015-04-25
9015
0015-01-03
9017
0015-04-25
9017
0015-03-28
9020
0015-02-07
9023
0015-04-18
9024
0015-03-14
9025
0015-03-28
9027
0015-01-24
9028
0015-02-14
9028
0015-04-18
9028
0015-04-25
9028
0015-02-21
9033
0015-01-17
9036
0015-02-14
9036
0015-03-07
9038
0015-02-28
9039
0015-04-11
932
0015-03-28
8012
0015-01-31
8014
0015-04-11
8014
0015-01-10
8016
0015-03-21
8016
0015-04-04
8016
0015-04-11
8016
0015-02-07
8017
0015-03-21
8018
0015-03-28
8018
0015-03-21
8019
0015-04-11
8019
0015-03-28
8021
0015-04-25
8026
0015-02-14
8030
0015-04-11
8036
0015-04-25
8040
0015-03-21
8041
0015-03-21
8042
0015-04-18
8044
0015-04-25
8046
0015-01-17
8511
0015-04-04
8511
0015-04-18
8511
0015-04-04
8513
0015-04-11
8516
0015-01-10
8518
0015-01-03
8519
0015-02-28
8520
0015-04-18
8522
0015-04-18
8527
0015-04-25
8528
0015-03-28
8531
0015-01-10
8534
0015-01-24
8534
0015-03-14
8535
0015-04-25
8535
0015-03-21
8538
0015-04-25
8540
0015-03-28
8541
0015-04-18
8544
0015-04-11
8546
0015-03-28
8548
0015-03-28
8549
0015-04-04
8549
0015-03-28
8550
0015-02-07
8551
0015-03-14
8551
0015-01-17
8552
0015-03-28
8553
0015-04-18
8553
0015-03-07
8554
0015-03-28
8554
0015-03-07
8556
0015-04-04
8556
0015-02-21
8558
0015-02-07
933
0015-04-11
933
0015-04-25
933
0015-04-19
801R
0015-04-26
801R
0015-01-24
803R
0015-02-08
803R
0015-01-31
9029
0015-03-29
9212
0015-03-08
9213
0015-04-19
9213
0015-03-22
9214
0015-03-29
9214
0015-02-08
9215
0015-04-19
9215
0015-03-01
9216
0015-04-19
9216
0015-02-15
9220
0015-04-19
9221
0015-04-19
9223
0015-04-26
9228
0015-03-08
9231
0015-02-01
9232
0015-04-05
9233
0015-04-12
9233
0015-03-15
9234
0015-04-12
9234
0015-04-26
9234
0015-01-25
9235
0015-01-04
9242
0015-02-08
9242
0015-01-18
9281
0015-02-22
9283
0015-03-01
9283
0015-01-25
8110
0015-02-15
8112
0015-04-05
8115
0015-04-12
8115
0015-02-08
8117
0015-03-15
8118
0015-04-05
8118
0015-03-15
8123
0015-03-22
8123
0015-03-15
8128
0015-02-15
8136
0015-04-12
8610
0015-03-15
8614
0015-04-12
8619
0015-01-18
8622
0015-04-05
8622
0015-02-15
8634
0015-03-22
8634
0015-04-12
8636
0015-01-04
8637
0015-03-22
8637
0015-04-19
8637
0015-04-19
8638
0015-03-29
8641
0015-04-12
8642
0015-04-26
8642
0015-03-15
8647
0015-01-25
8649
0015-01-11
8650
0015-04-05
8650
0015-01-04
8651
0015-03-22
8652
0015-04-12
8654
0015-02-08
8656
0015-02-16
6014
0015-02-18
6014
0015-02-16
611SEA
0015-02-17
611SEA
0015-01-22
307
0015-01-23
307
0015-02-06
307
0015-01-30
312
0015-03-10
312
0015-03-24
1013
0015-04-07
1013
0015-04-23
1013
0015-03-02
2015
0015-03-30
2015
0015-04-03
2015
0015-04-06
2015
0015-04-06
2021
0015-04-20
2021
0015-04-27
2021
0015-02-18
2050
0015-04-03
2050
0015-04-09
2050
0015-04-30
2050
0015-02-26
2061
0015-03-23
2061
0015-03-27
2061
0015-04-24
2061
0015-01-14
2065
0015-01-21
2065
0015-01-06
2110
0015-01-07
2110
0015-01-12
2110
0015-01-28
2110
0015-03-09
2110
0015-03-20
2110
0015-03-25
2110
0015-03-30
2110
0015-04-13
2110
0015-03-25
4024
0015-03-31
4024
0015-04-01
4024
0015-04-02
4024
0015-04-08
4024
0015-04-30
4024
0015-01-26
4036
0015-03-23
4036
0015-03-20
4038
0015-03-10
5016
0015-04-03
5080
0015-04-20
5080
0015-03-20
5081
0015-04-09
5081
0015-04-24
5081
0015-01-06
1010
0015-01-07
404R
0015-04-10
6170
0015-01-22
303
0015-02-09
303
0015-03-17
1213
0015-03-19
1213
0015-03-20
1213
0015-03-24
1213
0015-04-06
1213
0015-04-30
1213
0015-03-17
1274
0015-03-18
1274
0015-04-27
4043
0015-04-09
5079
0015-03-16
6120
0015-03-26
6120
0015-01-07
6121
0015-01-21
6121
0015-03-05
5083
0015-04-14
5083
0015-03-12
6161
0015-04-27
1275
0015-04-30
4143
0015-04-05
9230
0015-02-08
9238
0015-03-15
8662
0015-03-22
8662
0015-03-15
8138
0015-03-22
8138
0015-04-03
6015
0015-04-07
6015
0015-04-08
6015
0015-04-21
6015
0015-04-27
6015
0015-04-29
6015
0015-03-23
6067
0015-03-25
6711SEA
0015-03-31
6711SEA
0015-04-24
7010
0015-04-30
7010
0015-03-17
7011
0015-04-10
7011
0015-04-16
7011
0015-04-21
7011
0015-03-17
7012
0015-04-28
7013
0015-03-30
7014
0015-04-02
7014
0015-04-23
7014
0015-04-27
7014
0015-04-29
7014
0015-03-25
7020
0015-04-16
7020
0015-03-17
7021
0015-03-18
7021
0015-03-23
7021
0015-04-03
7021
0015-04-06
7021
0015-04-29
7021
0015-03-17
7110
0015-03-27
7110
0015-04-09
7110
0015-04-10
7110
0015-04-24
7110
0015-03-30
7111
0015-04-22
7111
0015-04-28
7111
0015-03-24
7112
0015-03-31
7112
0015-04-16
7112
0015-04-21
7112
0015-03-19
7113
0015-04-02
7113
0015-04-17
7113
0015-03-16
7114
0015-03-24
7114
0015-04-30
7114
0015-04-15
6720WS
0015-04-13
1080
0015-03-18
1081
0015-03-25
1081
0015-04-27
1522
0015-03-18
1710BELL
0015-03-24
1711BELL
0015-03-19
2026
0015-04-03
2055
0015-04-07
2055
0015-04-20
2055
0015-04-07
2080
0015-04-27
2080
0015-03-23
2081
0015-03-25
2081
0015-03-31
2081
0015-04-22
2081
0015-03-23
2082
0015-03-27
2082
0015-04-16
2082
0015-04-02
4025
0015-04-09
4025
0015-04-24
4025
0015-03-23
4028
0015-04-20
4028
0015-04-23
4029
0015-03-25
4066
0015-04-06
4066
0015-03-24
4113
0015-03-27
4113
0015-04-21
4113
0015-04-21
4115
0015-04-22
4115
0015-04-09
4720AUB
0015-04-13
4711RNT
0015-03-18
4712RNT
0015-03-26
4712RNT
0015-04-17
4712RNT
0015-04-02
4740FW
0015-03-20
5010
0015-04-02
5011
0015-03-30
5013TRC
0015-04-14
5013TRC
0015-04-21
5014TRC
0015-03-18
5075TRC
0015-03-18
5076TRC
0015-03-19
5076TRC
0015-03-23
5510
0015-03-24
5511TRC
0015-04-17
5511TRC
0015-04-03
5580
0015-04-01
5581TRC
0015-03-18
1083
0015-03-19
1083
0015-03-25
1083
0015-04-09
1083
0015-03-19
4044
0015-03-20
4044
0015-04-22
4045
0015-04-15
4046
0015-03-27
4068
0015-03-31
4116
0015-04-14
4116
0015-04-09
5035
0015-04-16
5035
0015-04-30
5035
0015-03-26
5064
0015-04-22
5064
0015-04-01
1061
0015-04-29
1074
0015-04-22
1085
0015-04-10
5512
0015-04-25
8050
0015-03-21
8051
0015-04-18
8052
Out[4]:
9        17
12       18
23       17
35       26
56       22
57       22
66       25
67       25
68       24
69       23
114      12
126      19
128      13
150      16
214      27
223      16
235      19
239      26
257      15
289      11
305      29
321      18
337      21
355      11
388      16
391      14
392       7
396       8
438      15
563      13
         ..
24378    22
24379    22
24430    13
24446    11
24459    14
24480    12
24510    23
24715    28
24716    29
24718    28
24723    26
24760    25
24761    39
24794    27
24810    28
24820    29
24849    23
24853    23
24907    24
24910    24
24915    12
24958    29
24969    38
24996    32
25020    26
25049    33
25161    13
25184    17
25185    12
25192    12
dtype: int64

In [5]:
fiftiers['NumActions'] = numActions
fiftiers.head()


/anaconda/lib/python2.7/site-packages/ipykernel/__main__.py:1: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  if __name__ == '__main__':
Out[5]:
ServiceDate Run CostProxy PctDeadhead NumActions
9 0015-01-01 9711 5500.000000 0.586091 17
12 0015-01-01 9713 5160.000000 0.568572 18
23 0015-01-01 9730 3240.833333 0.581589 17
35 0015-01-01 8710 3079.600000 0.506202 26
56 0015-03-07 999R 4750.625000 0.514248 22
Plot data

In [6]:
%matplotlib inline
import matplotlib.pyplot as plt

In [7]:
plt.plot(fiftiers.PctDeadhead, fiftiers.NumActions, 'ro')
plt.show()



In [8]:
fiftiers[fiftiers.NumActions == 0].head()


Out[8]:
ServiceDate Run CostProxy PctDeadhead NumActions
2396 0015-01-06 6013 3600.00 0.604444 0
2397 0015-01-08 6013 3412.50 0.553956 0
2481 0015-02-03 6020 2602.00 0.532063 0
2500 0015-03-02 6020 3727.50 0.500872 0
2537 0015-04-24 6020 3722.75 0.589618 0

Something is definitely wrong here


In [9]:
len(schedule[(schedule.ServiceDate == '0015-03-23') & (schedule.Run == 5071)])


Out[9]:
23