https://www.data.vic.gov.au/data/dataset/bus-boardings-and-alightings-at-bus-stops-new
Data Coverage Perod 01/01/2007 to 31/12/2010 (7:00am to 7:00pm weekday weighted observations)
Download Bus boardings and alightings xls file manually. The web page has a 'I consent to terms and conditions / I am not a robot' button that prevents automated downloading (or at least makes it harder than I expected).
Save file to './raw' directory
In [4]:
rawbus = './raw/Bus Boardings and Alightings - data.XLS'
In [5]:
import pandas as pd
df = pd.read_excel(rawbus,sheetname='Data', header=0,converters={'Route_Number':str,'Metlink_Stop_ID':str})
df
Out[5]:
Route_Number
Route_Name
Direction
Bus_Stop_Name
Stop_Sequence
Metlink_Stop_ID
Bus_Stop_Name.1
Boardings
Alightings
0
216
216 Caroline Springs - City - Brighton Beach
IN
Hartley St / South Rd (Xavier College Middle S...
0002
3234
Hartley St / South Rd (Xavier College Middle S...
2.827751
NaN
1
216
216 Caroline Springs - City - Brighton Beach
IN
Were St / New St
0004
3237
Were St / New St
1.736842
NaN
2
216
216 Caroline Springs - City - Brighton Beach
IN
Kinane St / New St
0005
3238
Kinane St / New St
8.161184
NaN
3
216
216 Caroline Springs - City - Brighton Beach
IN
Cosham St / New St
0011
3244
Cosham St / New St
NaN
NaN
4
216
216 Caroline Springs - City - Brighton Beach
IN
Bay St / New St
0012
3245
Bay St / New St
10.019139
NaN
5
216
216 Caroline Springs - City - Brighton Beach
IN
Rockbank Middle Rd / Westwood Dr
0129
3246
Rockbank Middle Rd / Westwood Dr
NaN
69.352273
6
216
216 Caroline Springs - City - Brighton Beach
IN
Tarcoola Dr / Westwood Dr
0128
3247
Tarcoola Dr / Westwood Dr
NaN
25.223983
7
216
216 Caroline Springs - City - Brighton Beach
IN
Roycroft Ave / Westwood Dr
0127
3248
Roycroft Ave / Westwood Dr
NaN
15.081938
8
216
216 Caroline Springs - City - Brighton Beach
IN
Billungah Pl / Westwood Dr
0126
3249
Billungah Pl / Westwood Dr
NaN
29.893242
9
216
216 Caroline Springs - City - Brighton Beach
IN
Torowatta Pl / Westwood Dr
0125
3250
Torowatta Pl / Westwood Dr
NaN
8.684211
10
216
216 Caroline Springs - City - Brighton Beach
IN
Elliott Ct / Westwood Dr (Burnside Shopping Ce...
0124
3251
Elliott Ct / Westwood Dr (Burnside Shopping Ce...
7.392344
85.377392
11
216
216 Caroline Springs - City - Brighton Beach
IN
Western Ring Rd / Ballarat Rd
0115
3253
Western Ring Rd / Ballarat Rd
NaN
26.070873
12
216
216 Caroline Springs - City - Brighton Beach
IN
Kunat St / Western Hwy
0123
3254
Kunat St / Western Hwy
1.562500
58.642344
13
216
216 Caroline Springs - City - Brighton Beach
IN
Carroll St / Western Hwy
0122
3255
Carroll St / Western Hwy
NaN
43.927333
14
216
216 Caroline Springs - City - Brighton Beach
IN
Hogan St / Western Hwy
0121
3256
Hogan St / Western Hwy
NaN
35.845993
15
216
216 Caroline Springs - City - Brighton Beach
IN
Summers St / Western Hwy (St Peters Church and...
0120
3257
Summers St / Western Hwy (St Peters Church and...
NaN
17.979366
16
216
216 Caroline Springs - City - Brighton Beach
IN
Miles St / Western Hwy
0119
3258
Miles St / Western Hwy
5.210526
19.201555
17
216
216 Caroline Springs - City - Brighton Beach
IN
Station Rd / Ballarat Rd
0118
3259
Station Rd / Ballarat Rd
17.587620
81.111842
18
216
216 Caroline Springs - City - Brighton Beach
IN
Glencairn Ave / Ballarat Rd (Deer Park Oval)
0117
3260
Glencairn Ave / Ballarat Rd (Deer Park Oval)
NaN
9.426435
19
216
216 Caroline Springs - City - Brighton Beach
IN
Cairnlea Dr / Ballarat Rd
0116
3263
Cairnlea Dr / Ballarat Rd
NaN
15.526914
20
216
216 Caroline Springs - City - Brighton Beach
IN
Holt St / Ballarat Rd
0114
3266
Holt St / Ballarat Rd
3.473684
9.600778
21
216
216 Caroline Springs - City - Brighton Beach
IN
Chatsworth Ave / Ballarat Rd
0113
3267
Chatsworth Ave / Ballarat Rd
11.111842
19.297847
22
216
216 Caroline Springs - City - Brighton Beach
IN
Verdant Ave / Ballarat Rd (Sunshine Motor Inn)
0112
3268
Verdant Ave / Ballarat Rd (Sunshine Motor Inn)
NaN
44.251196
23
216
216 Caroline Springs - City - Brighton Beach
IN
Wasley St / Ballarat Rd
0111
3269
Wasley St / Ballarat Rd
3.125000
16.644438
24
216
216 Caroline Springs - City - Brighton Beach
IN
Perth Ave / Ballarat Rd
0110
3270
Perth Ave / Ballarat Rd
1.736842
16.767344
25
216
216 Caroline Springs - City - Brighton Beach
IN
Maylands St / Ballarat Rd
0109
3271
Maylands St / Ballarat Rd
1.090909
10.517344
26
216
216 Caroline Springs - City - Brighton Beach
IN
Sydney St / Ballarat Rd (Albion Railway Station)
0108
3274
Sydney St / Ballarat Rd (Albion Railway Station)
125.499103
20.589713
27
216
216 Caroline Springs - City - Brighton Beach
IN
Bazentin St / Sydney St
0107
3275
Bazentin St / Sydney St
5.481160
12.674342
28
216
216 Caroline Springs - City - Brighton Beach
IN
Drummartin St / Sydney St
0105
3276
Drummartin St / Sydney St
NaN
24.403708
29
216
216 Caroline Springs - City - Brighton Beach
IN
Kororoit St / Forrest St
0104
3277
Kororoit St / Forrest St
NaN
10.343002
...
...
...
...
...
...
...
...
...
...
29767
928
928 Pakenham South
NaN
Savage St / Opp 23 Henty St
0016
3735
Savage St / Opp 23 Henty St
NaN
NaN
29768
928
928 Pakenham South
NaN
Thomas Pl / Opp 9 Henty St
0017
3736
Thomas Pl / Opp 9 Henty St
NaN
NaN
29769
928
928 Pakenham South
NaN
78 McGregor Rd
0005
21453
78 McGregor Rd
NaN
NaN
29770
928
928 Pakenham South
NaN
7 Park Bvd
0006
21454
7 Park Bvd
NaN
NaN
29771
928
928 Pakenham South
NaN
Sheoak Ct / Sandalwood Dr
0007
21455
Sheoak Ct / Sandalwood Dr
NaN
NaN
29772
928
928 Pakenham South
NaN
Redfern Way / Clifford Dr
0008
21456
Redfern Way / Clifford Dr
NaN
NaN
29773
928
928 Pakenham South
NaN
12 Park Bvd
0009
21457
12 Park Bvd
NaN
NaN
29774
928
928 Pakenham South
NaN
McGregor Rd / Henry Rd
0010
21458
McGregor Rd / Henry Rd
NaN
NaN
29775
928
928 Pakenham South
NaN
Henry Rd
0011
21459
Henry Rd
NaN
NaN
29776
928
928 Pakenham South
NaN
Livingstone Bvd / Henry Lawson Dr
0012
21460
Livingstone Bvd / Henry Lawson Dr
NaN
NaN
29777
928
928 Pakenham South
NaN
Shearers Ct / 34 Heritage Bvd
0013
21493
Shearers Ct / 34 Heritage Bvd
NaN
1.000000
29778
928
928 Pakenham South
NaN
McGregor Rd / Opp 5 Heritage Bvd
0014
21494
McGregor Rd / Opp 5 Heritage Bvd
NaN
NaN
29779
929
929 Pakenham Town Centre
NaN
Pakenham Shops, Cook Dr / Station St
0001
3426
Pakenham Shops, Cook Dr / Station St
42.000000
38.000000
29780
929
929 Pakenham Town Centre
NaN
Pakenham Shops, Cook Dr / Station St
0018
3426
Pakenham Shops, Cook Dr / Station St
42.000000
38.000000
29781
929
929 Pakenham Town Centre
NaN
Pakenham Railway Station / Railway Ave
0017
3427
Pakenham Railway Station / Railway Ave
NaN
NaN
29782
929
929 Pakenham Town Centre
NaN
Pakenham Racecourse, Racecourse Rd / Railway Ave
0002
3428
Pakenham Racecourse, Racecourse Rd / Railway Ave
NaN
NaN
29783
929
929 Pakenham Town Centre
NaN
Princes Hwy / Racecourse Rd
0007
3431
Princes Hwy / Racecourse Rd
NaN
NaN
29784
929
929 Pakenham Town Centre
NaN
Princes Hwy / Racecourse Rd
0011
3722
Princes Hwy / Racecourse Rd
NaN
NaN
29785
929
929 Pakenham Town Centre
NaN
Pakenham Racecourse, Racecourse Rd / Railway Ave
0016
3724
Pakenham Racecourse, Racecourse Rd / Railway Ave
NaN
NaN
29786
929
929 Pakenham Town Centre
NaN
Princes Hwy / Army Rd
0008
21442
Princes Hwy / Army Rd
NaN
5.000000
29787
929
929 Pakenham Town Centre
NaN
Princes Hwy / Army Rd
0010
21443
Princes Hwy / Army Rd
NaN
NaN
29788
929
929 Pakenham Town Centre
NaN
Kennedy Rd / Army Rd
0009
21444
Kennedy Rd / Army Rd
21.000000
32.000000
29789
929
929 Pakenham Town Centre
NaN
Racecourse Rd / Barrington Dr
0006
21445
Racecourse Rd / Barrington Dr
9.000000
4.000000
29790
929
929 Pakenham Town Centre
NaN
Diane Cl / Opp 3 Barrington Dr
0012
21446
Diane Cl / Opp 3 Barrington Dr
3.000000
1.000000
29791
929
929 Pakenham Town Centre
NaN
Harness Pl / Opp 46 Barrington Dr
0005
21447
Harness Pl / Opp 46 Barrington Dr
5.000000
4.000000
29792
929
929 Pakenham Town Centre
NaN
Harness Pl / 46 Barrington Dr
0013
21448
Harness Pl / 46 Barrington Dr
NaN
NaN
29793
929
929 Pakenham Town Centre
NaN
46 Cameron Way
0004
21449
46 Cameron Way
NaN
1.000000
29794
929
929 Pakenham Town Centre
NaN
45 Cameron Way
0014
21450
45 Cameron Way
2.000000
NaN
29795
929
929 Pakenham Town Centre
NaN
Racecourse Rd / Opp 2a Cameron Way
0003
21451
Racecourse Rd / Opp 2a Cameron Way
NaN
NaN
29796
929
929 Pakenham Town Centre
NaN
Racecourse Rd / 2a Cameron Way
0015
21452
Racecourse Rd / 2a Cameron Way
4.000000
1.000000
29797 rows × 9 columns
This script groups all the reported bus boardings and alightings for a given stop If multiple routes use the same stop the results from multiple routes will be combined into a single "boarding" value and a single "alighting" value.
Results are saved as
'./clean/BusStopTraffic.csv'
Index: 'Metlink_Stop_ID' columns 'Boardings', 'Alightings' and 'wk7am7pm' ('wk7am7pm' is sum of Boardings and Alightings)
In [6]:
bystop = df.groupby('Metlink_Stop_ID').sum()
bystop['wk7am7pm'] = bystop.Boardings.fillna(0) + bystop.Alightings.fillna(0)
bystop.to_csv('./clean/BusStopTraffic.csv')
bystop
Out[6]:
Boardings
Alightings
wk7am7pm
Metlink_Stop_ID
1000
NaN
8.000000
8.000000
10000
4.500000
9.000000
13.500000
10001
8.571429
12.214286
20.785714
10002
1.642857
NaN
1.642857
10003
9.000000
4.500000
13.500000
10004
1.500000
3.000000
4.500000
10006
12.681818
20.590909
33.272727
10007
10.500000
10.500000
21.000000
10008
22.500000
6.000000
28.500000
10009
37.500000
3.000000
40.500000
1001
2.000000
11.764706
13.764706
10010
28.500000
9.000000
37.500000
10011
19.500000
NaN
19.500000
10012
12.000000
4.500000
16.500000
10013
1.500000
12.000000
13.500000
10014
NaN
NaN
0.000000
10016
8.571429
24.000000
32.571429
10017
NaN
8.571429
8.571429
10018
74.217879
133.309211
207.527090
10019
13.333333
10.666667
24.000000
1002
2.000000
50.000000
52.000000
10020
37.333333
21.333333
58.666667
10021
133.333333
24.000000
157.333333
10022
18.666667
13.333333
32.000000
10023
8.000000
10.666667
18.666667
10025
NaN
18.666667
18.666667
10026
5.333333
26.666667
32.000000
10027
8.000000
18.666667
26.666667
10028
10.666667
37.333333
48.000000
10029
5.333333
16.000000
21.333333
...
...
...
...
9971
2.125000
32.000000
34.125000
9972
NaN
3.368421
3.368421
9973
3.368421
NaN
3.368421
9974
1.684211
3.368421
5.052632
9975
1.684211
11.789474
13.473684
9976
1.684211
NaN
1.684211
9977
10.733333
7.666667
18.400000
9978
12.266667
15.333333
27.600000
9979
15.333333
19.933333
35.266667
998
NaN
22.000000
22.000000
9980
6.133333
6.133333
12.266667
9981
6.133333
3.066667
9.200000
9982
4.600000
NaN
4.600000
9983
NaN
1.533333
1.533333
9984
27.600000
19.933333
47.533333
9985
21.466667
4.600000
26.066667
9986
42.933333
21.466667
64.400000
9987
13.800000
10.733333
24.533333
9988
NaN
12.266667
12.266667
9989
16.358974
113.866667
130.225641
999
NaN
7.764706
7.764706
9990
1.846154
2.533333
4.379487
9991
11.789474
8.421053
20.210526
9992
6.736842
10.105263
16.842105
9993
1.684211
28.631579
30.315789
9994
6.000000
18.000000
24.000000
9995
1.642857
NaN
1.642857
9997
32.307692
11.769231
44.076923
9998
11.653846
15.576923
27.230769
9999
NaN
3.000000
3.000000
17618 rows × 3 columns
All data has been weighted post hoc to ensure that is representative for each route, direction and day type for the 7:00am to 7:00pm period. This results in a sample that is representative of all scheduled trips within the survey period for a typical Weekday. This was an attempt to build a consistent picture of an average day across the network. The data collected is designed to represent a 'typical' weekday, Saturday, Sunday in the broadest sense of the word; it is not a true average created over many days. Rather it is a snapshot of a single or couple of days, with all the risks regarding seasonality that entails.
In [ ]:
Content source: FunOnTheUpfield/DataVicGovAuPTDataCleaner
Similar notebooks: