In [1]:
import csv
import pandas as pd
import numpy as np
import src.misc.paths as path
import sys
import os
print(os.getcwd())
print(sys.version_info)
C:\Users\Chrisi\Desktop\Studium\BigDataScience\sose17-small-data\python\traffic-prediction
sys.version_info(major=3, minor=5, micro=2, releaselevel='final', serial=0)
In [2]:
path.trajectories_training_file
Out[2]:
'../../../../dataset/training/trajectories(table 5)_training.csv'
In [3]:
training_files = "../../dataset/training/"
links_file = "links (table 3).csv"
routes_file = "routes (table 4).csv"
trajectories_file = "trajectories(table 5)_training.csv"
volume_file = "volume(table 6)_training.csv"
weather_file = "weather (table 7)_training.csv"
routes_df = pd.read_csv(training_files+routes_file)
links_df = pd.read_csv(training_files+links_file)
volume_df = pd.read_csv(training_files+volume_file)
trajectories_df = pd.read_csv(training_files+trajectories_file)
weather_df = pd.read_csv(training_files+weather_file)
#training_files = "../../new_dataset/training/"
#trajectories_df = pd.read_csv(training_files+trajectories_file)
#weather_df = pd.read_csv(training_files+weather_file)
In [4]:
routes_df
Out[4]:
intersection_id
tollgate_id
link_seq
0
A
2
110,123,107,108,120,117
1
A
3
110,123,107,108,119,114,118,122
2
B
1
105,100,111,103,116,101,121,106,113
3
B
3
105,100,111,103,122
4
C
1
115,102,109,104,112,111,103,116,101,121,106,113
5
C
3
115,102,109,104,112,111,103,122
In [5]:
import src.vector_gen.generateCurrentSituationVector as gcsv
import src.vector_gen.generateWeatherVectors as gwv
import src.vector_gen.generateTimeInformationVector as tiv
In [6]:
print('generate_timeInformationVectors')
print(gwv.generate_timeInformationVectors(trajectories_df))
print('generate_timeInformationWeatherVectors')
print(gwv.generate_timeInformationWeatherVectors(trajectories_df, weather_df))
print('generate_CurrentSituationWeatherVectors')
print(gwv.generate_CurrentSituationWeatherVectors(trajectories_df, weather_df))
print('generate_TimeInformationCurrentSituationWeatherVectors')
print(gwv.generate_TimeInformationCurrentSituationWeatherVectors(trajectories_df.copy(), weather_df.copy()))
generate_timeInformationVectors
(array([ 1, 0, 0, ..., 0, 21, 40], dtype=int64), array([ 37.09, 35.27, 15.58, ..., 39.47, 35.92, 21.77]))
generate_timeInformationWeatherVectors
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-6-3d02ba8fb01f> in <module>()
3
4 print('generate_timeInformationWeatherVectors')
----> 5 print(gwv.generate_timeInformationWeatherVectors(trajectories_df, weather_df))
6
7 print('generate_CurrentSituationWeatherVectors')
C:\Users\Chrisi\Desktop\Studium\BigDataScience\sose17-small-data\python\traffic-prediction\src\vector_gen\generateWeatherVectors.py in generate_timeInformationWeatherVectors(trajectories_df, weather_df)
184
185 X_df = generate_timeInformationVectorX_df(trajectories_df, add_datetime=True)
--> 186 weather_df1 = prepare_weather_df(weather_df)
187
188 # add weather
C:\Users\Chrisi\Desktop\Studium\BigDataScience\sose17-small-data\python\traffic-prediction\src\vector_gen\generateWeatherVectors.py in prepare_weather_df(weather_df)
95 # weather_df[weather_df['wind_speed'] <= 0.3]
96
---> 97 weather_df['datetime'] = pd.to_datetime(weather_df['date']) + pd.to_timedelta(weather_df['hour'], unit='h')
98
99 # make weather for each tw
C:\Anaconda3\lib\site-packages\pandas\core\ops.py in wrapper(left, right, name, na_op)
607
608 time_converted = _TimeOp.maybe_convert_for_time_op(left, right, name,
--> 609 na_op)
610
611 if time_converted is None:
C:\Anaconda3\lib\site-packages\pandas\core\ops.py in maybe_convert_for_time_op(cls, left, right, name, na_op)
567 return None
568
--> 569 return cls(left, right, name, na_op)
570
571
C:\Anaconda3\lib\site-packages\pandas\core\ops.py in __init__(self, left, right, name, na_op)
280 left, right = left.align(right, copy=False)
281
--> 282 lvalues = self._convert_to_array(left, name=name)
283 rvalues = self._convert_to_array(right, name=name, other=lvalues)
284
C:\Anaconda3\lib\site-packages\pandas\core\ops.py in _convert_to_array(self, values, name, other)
396 supplied_dtype = values.dtype
397 inferred_type = supplied_dtype or lib.infer_dtype(values)
--> 398 if (inferred_type in ('datetime64', 'datetime', 'date', 'time') or
399 com.is_datetimetz(inferred_type)):
400 # if we have a other of timedelta, but use pd.NaT here we
TypeError: data type "datetime" not understood
In [54]:
X, Y = tiv.generate_timeInformationVector(trajectories_df)
X
Out[54]:
array([ 1, 0, 0, ..., 0, 21, 40])
In [56]:
pd.DataFrame(X.reshape(len(X)/3, 3))
C:\Anaconda3\lib\site-packages\ipykernel\__main__.py:1: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
if __name__ == '__main__':
Out[56]:
0
1
2
0
1
0
0
1
1
0
20
2
1
0
40
3
1
1
20
4
1
1
40
5
1
2
0
6
1
2
20
7
1
2
40
8
1
3
0
9
1
3
20
10
1
3
40
11
1
4
0
12
1
4
20
13
1
4
40
14
1
5
0
15
1
5
20
16
1
5
40
17
1
6
0
18
1
6
20
19
1
6
40
20
1
7
0
21
1
7
20
22
1
7
40
23
1
8
0
24
1
8
20
25
1
8
40
26
1
9
0
27
1
9
20
28
1
9
40
29
1
10
0
...
...
...
...
6326
0
12
0
6327
0
12
20
6328
0
12
40
6329
0
13
0
6330
0
13
20
6331
0
13
40
6332
0
14
0
6333
0
14
20
6334
0
14
40
6335
0
15
0
6336
0
15
20
6337
0
15
40
6338
0
16
0
6339
0
16
20
6340
0
16
40
6341
0
17
0
6342
0
17
20
6343
0
17
40
6344
0
18
0
6345
0
18
20
6346
0
18
40
6347
0
19
0
6348
0
19
20
6349
0
19
40
6350
0
20
0
6351
0
20
20
6352
0
20
40
6353
0
21
0
6354
0
21
20
6355
0
21
40
6356 rows × 3 columns
In [6]:
x_df = gcsv.generate_x_df(trajectories_df)
x_df = pd.DataFrame(x_df)
x_df
Out[6]:
link_avg_withoutNaN
tw
link
2016-07-19 00:00:00
100
6.75
101
2.38
102
3.22
103
7.47
104
7.20
105
9.56
106
0.61
107
3.12
108
4.10
109
2.99
110
10.51
111
13.00
112
8.37
113
6.25
114
10.00
115
3.67
116
5.05
117
22.89
118
16.72
119
0.51
120
1.14
121
7.03
122
32.85
123
5.39
2016-07-19 00:20:00
100
5.15
101
5.27
102
3.33
103
3.54
104
6.97
105
8.42
...
...
...
2016-10-17 21:20:00
118
32.08
119
0.91
120
0.89
121
11.92
122
28.64
123
6.32
2016-10-17 21:40:00
100
5.73
101
5.43
102
5.48
103
5.53
104
15.42
105
10.22
106
1.98
107
2.86
108
3.78
109
5.26
110
12.04
111
23.38
112
16.39
113
16.83
114
16.29
115
5.53
116
13.49
117
15.55
118
21.08
119
0.73
120
0.73
121
12.75
122
39.02
123
4.40
157104 rows × 1 columns
In [7]:
w_df = gwv.prepare_weather_df(weather_df)
w_df.index.names = ['tw']
#w_df['tw'] = w_df.index
w_df = w_df.reset_index()
w_df
Out[7]:
tw
date
hour
pressure
sea_pressure
wind_direction
wind_speed
temperature
rel_humidity
precipitation
0
2016-07-01 00:00:00
2016-07-01
0
1000.4
1005.3
2.1
2.1
26.4
94.0
0.0
1
2016-07-01 00:20:00
2016-07-01
0
1000.4
1005.3
2.1
2.1
26.4
94.0
0.0
2
2016-07-01 00:40:00
2016-07-01
0
1000.4
1005.3
2.1
2.1
26.4
94.0
0.0
3
2016-07-01 01:00:00
2016-07-01
0
1000.4
1005.3
2.1
2.1
26.4
94.0
0.0
4
2016-07-01 01:20:00
2016-07-01
0
1000.4
1005.3
2.1
2.1
26.4
94.0
0.0
5
2016-07-01 01:40:00
2016-07-01
0
1000.4
1005.3
2.1
2.1
26.4
94.0
0.0
6
2016-07-01 02:00:00
2016-07-01
0
1000.4
1005.3
2.1
2.1
26.4
94.0
0.0
7
2016-07-01 02:20:00
2016-07-01
0
1000.4
1005.3
2.1
2.1
26.4
94.0
0.0
8
2016-07-01 02:40:00
2016-07-01
0
1000.4
1005.3
2.1
2.1
26.4
94.0
0.0
9
2016-07-01 03:00:00
2016-07-01
3
1000.5
1005.3
2.7
2.7
29.0
76.0
0.0
10
2016-07-01 03:20:00
2016-07-01
3
1000.5
1005.3
2.7
2.7
29.0
76.0
0.0
11
2016-07-01 03:40:00
2016-07-01
3
1000.5
1005.3
2.7
2.7
29.0
76.0
0.0
12
2016-07-01 04:00:00
2016-07-01
3
1000.5
1005.3
2.7
2.7
29.0
76.0
0.0
13
2016-07-01 04:20:00
2016-07-01
3
1000.5
1005.3
2.7
2.7
29.0
76.0
0.0
14
2016-07-01 04:40:00
2016-07-01
3
1000.5
1005.3
2.7
2.7
29.0
76.0
0.0
15
2016-07-01 05:00:00
2016-07-01
3
1000.5
1005.3
2.7
2.7
29.0
76.0
0.0
16
2016-07-01 05:20:00
2016-07-01
3
1000.5
1005.3
2.7
2.7
29.0
76.0
0.0
17
2016-07-01 05:40:00
2016-07-01
3
1000.5
1005.3
2.7
2.7
29.0
76.0
0.0
18
2016-07-01 06:00:00
2016-07-01
6
998.9
1003.7
2.9
2.9
31.7
67.0
0.0
19
2016-07-01 06:20:00
2016-07-01
6
998.9
1003.7
2.9
2.9
31.7
67.0
0.0
20
2016-07-01 06:40:00
2016-07-01
6
998.9
1003.7
2.9
2.9
31.7
67.0
0.0
21
2016-07-01 07:00:00
2016-07-01
6
998.9
1003.7
2.9
2.9
31.7
67.0
0.0
22
2016-07-01 07:20:00
2016-07-01
6
998.9
1003.7
2.9
2.9
31.7
67.0
0.0
23
2016-07-01 07:40:00
2016-07-01
6
998.9
1003.7
2.9
2.9
31.7
67.0
0.0
24
2016-07-01 08:00:00
2016-07-01
6
998.9
1003.7
2.9
2.9
31.7
67.0
0.0
25
2016-07-01 08:20:00
2016-07-01
6
998.9
1003.7
2.9
2.9
31.7
67.0
0.0
26
2016-07-01 08:40:00
2016-07-01
6
998.9
1003.7
2.9
2.9
31.7
67.0
0.0
27
2016-07-01 09:00:00
2016-07-01
9
998.7
1003.5
2.7
2.7
31.6
59.0
0.0
28
2016-07-01 09:20:00
2016-07-01
9
998.7
1003.5
2.7
2.7
31.6
59.0
0.0
29
2016-07-01 09:40:00
2016-07-01
9
998.7
1003.5
2.7
2.7
31.6
59.0
0.0
...
...
...
...
...
...
...
...
...
...
...
7008
2016-10-17 14:00:00
2016-10-17
12
1014.3
1019.4
0.7
0.7
19.6
87.0
0.0
7009
2016-10-17 14:20:00
2016-10-17
12
1014.3
1019.4
0.7
0.7
19.6
87.0
0.0
7010
2016-10-17 14:40:00
2016-10-17
12
1014.3
1019.4
0.7
0.7
19.6
87.0
0.0
7011
2016-10-17 15:00:00
2016-10-17
15
1014.7
1019.8
0.9
0.9
18.9
92.0
0.0
7012
2016-10-17 15:20:00
2016-10-17
15
1014.7
1019.8
0.9
0.9
18.9
92.0
0.0
7013
2016-10-17 15:40:00
2016-10-17
15
1014.7
1019.8
0.9
0.9
18.9
92.0
0.0
7014
2016-10-17 16:00:00
2016-10-17
15
1014.7
1019.8
0.9
0.9
18.9
92.0
0.0
7015
2016-10-17 16:20:00
2016-10-17
15
1014.7
1019.8
0.9
0.9
18.9
92.0
0.0
7016
2016-10-17 16:40:00
2016-10-17
15
1014.7
1019.8
0.9
0.9
18.9
92.0
0.0
7017
2016-10-17 17:00:00
2016-10-17
15
1014.7
1019.8
0.9
0.9
18.9
92.0
0.0
7018
2016-10-17 17:20:00
2016-10-17
15
1014.7
1019.8
0.9
0.9
18.9
92.0
0.0
7019
2016-10-17 17:40:00
2016-10-17
15
1014.7
1019.8
0.9
0.9
18.9
92.0
0.0
7020
2016-10-17 18:00:00
2016-10-17
18
1014.0
1019.0
1.5
1.5
19.1
92.0
0.0
7021
2016-10-17 18:20:00
2016-10-17
18
1014.0
1019.0
1.5
1.5
19.1
92.0
0.0
7022
2016-10-17 18:40:00
2016-10-17
18
1014.0
1019.0
1.5
1.5
19.1
92.0
0.0
7023
2016-10-17 19:00:00
2016-10-17
18
1014.0
1019.0
1.5
1.5
19.1
92.0
0.0
7024
2016-10-17 19:20:00
2016-10-17
18
1014.0
1019.0
1.5
1.5
19.1
92.0
0.0
7025
2016-10-17 19:40:00
2016-10-17
18
1014.0
1019.0
1.5
1.5
19.1
92.0
0.0
7026
2016-10-17 20:00:00
2016-10-17
18
1014.0
1019.0
1.5
1.5
19.1
92.0
0.0
7027
2016-10-17 20:20:00
2016-10-17
18
1014.0
1019.0
1.5
1.5
19.1
92.0
0.0
7028
2016-10-17 20:40:00
2016-10-17
18
1014.0
1019.0
1.5
1.5
19.1
92.0
0.0
7029
2016-10-17 21:00:00
2016-10-17
21
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
7030
2016-10-17 21:20:00
2016-10-17
21
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
7031
2016-10-17 21:40:00
2016-10-17
21
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
7032
2016-10-17 22:00:00
2016-10-17
21
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
7033
2016-10-17 22:20:00
2016-10-17
21
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
7034
2016-10-17 22:40:00
2016-10-17
21
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
7035
2016-10-17 23:00:00
2016-10-17
21
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
7036
2016-10-17 23:20:00
2016-10-17
21
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
7037
2016-10-17 23:40:00
2016-10-17
21
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
7038 rows × 10 columns
In [8]:
x_df2 = x_df.reset_index()
x_df2
Out[8]:
tw
link
link_avg_withoutNaN
0
2016-07-19 00:00:00
100
6.75
1
2016-07-19 00:00:00
101
2.38
2
2016-07-19 00:00:00
102
3.22
3
2016-07-19 00:00:00
103
7.47
4
2016-07-19 00:00:00
104
7.20
5
2016-07-19 00:00:00
105
9.56
6
2016-07-19 00:00:00
106
0.61
7
2016-07-19 00:00:00
107
3.12
8
2016-07-19 00:00:00
108
4.10
9
2016-07-19 00:00:00
109
2.99
10
2016-07-19 00:00:00
110
10.51
11
2016-07-19 00:00:00
111
13.00
12
2016-07-19 00:00:00
112
8.37
13
2016-07-19 00:00:00
113
6.25
14
2016-07-19 00:00:00
114
10.00
15
2016-07-19 00:00:00
115
3.67
16
2016-07-19 00:00:00
116
5.05
17
2016-07-19 00:00:00
117
22.89
18
2016-07-19 00:00:00
118
16.72
19
2016-07-19 00:00:00
119
0.51
20
2016-07-19 00:00:00
120
1.14
21
2016-07-19 00:00:00
121
7.03
22
2016-07-19 00:00:00
122
32.85
23
2016-07-19 00:00:00
123
5.39
24
2016-07-19 00:20:00
100
5.15
25
2016-07-19 00:20:00
101
5.27
26
2016-07-19 00:20:00
102
3.33
27
2016-07-19 00:20:00
103
3.54
28
2016-07-19 00:20:00
104
6.97
29
2016-07-19 00:20:00
105
8.42
...
...
...
...
157074
2016-10-17 21:20:00
118
32.08
157075
2016-10-17 21:20:00
119
0.91
157076
2016-10-17 21:20:00
120
0.89
157077
2016-10-17 21:20:00
121
11.92
157078
2016-10-17 21:20:00
122
28.64
157079
2016-10-17 21:20:00
123
6.32
157080
2016-10-17 21:40:00
100
5.73
157081
2016-10-17 21:40:00
101
5.43
157082
2016-10-17 21:40:00
102
5.48
157083
2016-10-17 21:40:00
103
5.53
157084
2016-10-17 21:40:00
104
15.42
157085
2016-10-17 21:40:00
105
10.22
157086
2016-10-17 21:40:00
106
1.98
157087
2016-10-17 21:40:00
107
2.86
157088
2016-10-17 21:40:00
108
3.78
157089
2016-10-17 21:40:00
109
5.26
157090
2016-10-17 21:40:00
110
12.04
157091
2016-10-17 21:40:00
111
23.38
157092
2016-10-17 21:40:00
112
16.39
157093
2016-10-17 21:40:00
113
16.83
157094
2016-10-17 21:40:00
114
16.29
157095
2016-10-17 21:40:00
115
5.53
157096
2016-10-17 21:40:00
116
13.49
157097
2016-10-17 21:40:00
117
15.55
157098
2016-10-17 21:40:00
118
21.08
157099
2016-10-17 21:40:00
119
0.73
157100
2016-10-17 21:40:00
120
0.73
157101
2016-10-17 21:40:00
121
12.75
157102
2016-10-17 21:40:00
122
39.02
157103
2016-10-17 21:40:00
123
4.40
157104 rows × 3 columns
In [9]:
df = pd.merge(x_df2, w_df, how='left')
df = df.set_index(['tw','link'])
df = df[['link_avg_withoutNaN', 'pressure', 'sea_pressure', 'wind_direction', 'wind_speed', 'temperature', 'rel_humidity', 'precipitation']]
df
Out[9]:
link_avg_withoutNaN
pressure
sea_pressure
wind_direction
wind_speed
temperature
rel_humidity
precipitation
tw
link
2016-07-19 00:00:00
100
6.75
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
101
2.38
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
102
3.22
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
103
7.47
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
104
7.20
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
105
9.56
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
106
0.61
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
107
3.12
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
108
4.10
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
109
2.99
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
110
10.51
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
111
13.00
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
112
8.37
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
113
6.25
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
114
10.00
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
115
3.67
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
116
5.05
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
117
22.89
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
118
16.72
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
119
0.51
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
120
1.14
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
121
7.03
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
122
32.85
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
123
5.39
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
2016-07-19 00:20:00
100
5.15
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
101
5.27
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
102
3.33
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
103
3.54
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
104
6.97
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
105
8.42
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
...
...
...
...
...
...
...
...
...
...
2016-10-17 21:20:00
118
32.08
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
119
0.91
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
120
0.89
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
121
11.92
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
122
28.64
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
123
6.32
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
2016-10-17 21:40:00
100
5.73
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
101
5.43
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
102
5.48
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
103
5.53
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
104
15.42
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
105
10.22
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
106
1.98
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
107
2.86
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
108
3.78
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
109
5.26
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
110
12.04
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
111
23.38
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
112
16.39
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
113
16.83
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
114
16.29
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
115
5.53
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
116
13.49
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
117
15.55
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
118
21.08
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
119
0.73
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
120
0.73
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
121
12.75
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
122
39.02
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
123
4.40
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
157104 rows × 8 columns
In [10]:
x = np.array(df)
x.reshape((len(df.columns)*len(df), 1))
Out[10]:
array([[ 6.75],
[ 1000.9 ],
[ 1005.8 ],
...,
[ 19.3 ],
[ 90. ],
[ 0. ]])
In [35]:
csw_df = gwv.generate_CurrentSituationWeatherVectorX_df(trajectories_df, weather_df)
csw_df
Out[35]:
link_avg_withoutNaN
date
hour
pressure
sea_pressure
wind_direction
wind_speed
temperature
rel_humidity
precipitation
tw
link
2016-07-19 00:00:00
100
6.75
2016-07-19
0.0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
101
2.38
2016-07-19
0.0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
102
3.22
2016-07-19
0.0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
103
7.47
2016-07-19
0.0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
104
7.20
2016-07-19
0.0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
105
9.56
2016-07-19
0.0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
106
0.61
2016-07-19
0.0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
107
3.12
2016-07-19
0.0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
108
4.10
2016-07-19
0.0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
109
2.99
2016-07-19
0.0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
110
10.51
2016-07-19
0.0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
111
13.00
2016-07-19
0.0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
112
8.37
2016-07-19
0.0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
113
6.25
2016-07-19
0.0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
114
10.00
2016-07-19
0.0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
115
3.67
2016-07-19
0.0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
116
5.05
2016-07-19
0.0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
117
22.89
2016-07-19
0.0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
118
16.72
2016-07-19
0.0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
119
0.51
2016-07-19
0.0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
120
1.14
2016-07-19
0.0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
121
7.03
2016-07-19
0.0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
122
32.85
2016-07-19
0.0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
123
5.39
2016-07-19
0.0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
2016-07-19 00:20:00
100
5.15
2016-07-19
0.0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
101
5.27
2016-07-19
0.0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
102
3.33
2016-07-19
0.0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
103
3.54
2016-07-19
0.0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
104
6.97
2016-07-19
0.0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
105
8.42
2016-07-19
0.0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
...
...
...
...
...
...
...
...
...
...
...
...
2016-10-17 21:20:00
118
32.08
2016-10-17
21.0
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
119
0.91
2016-10-17
21.0
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
120
0.89
2016-10-17
21.0
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
121
11.92
2016-10-17
21.0
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
122
28.64
2016-10-17
21.0
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
123
6.32
2016-10-17
21.0
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
2016-10-17 21:40:00
100
5.73
2016-10-17
21.0
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
101
5.43
2016-10-17
21.0
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
102
5.48
2016-10-17
21.0
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
103
5.53
2016-10-17
21.0
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
104
15.42
2016-10-17
21.0
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
105
10.22
2016-10-17
21.0
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
106
1.98
2016-10-17
21.0
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
107
2.86
2016-10-17
21.0
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
108
3.78
2016-10-17
21.0
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
109
5.26
2016-10-17
21.0
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
110
12.04
2016-10-17
21.0
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
111
23.38
2016-10-17
21.0
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
112
16.39
2016-10-17
21.0
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
113
16.83
2016-10-17
21.0
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
114
16.29
2016-10-17
21.0
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
115
5.53
2016-10-17
21.0
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
116
13.49
2016-10-17
21.0
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
117
15.55
2016-10-17
21.0
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
118
21.08
2016-10-17
21.0
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
119
0.73
2016-10-17
21.0
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
120
0.73
2016-10-17
21.0
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
121
12.75
2016-10-17
21.0
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
122
39.02
2016-10-17
21.0
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
123
4.40
2016-10-17
21.0
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
157104 rows × 10 columns
In [37]:
csw_df['datetime'] = csw_df.index.get_level_values('tw')
csw_df['datetime'] = pd.to_datetime(csw_df['datetime'])
csw_df['hour'] = csw_df['datetime'].dt.hour
csw_df['minute'] = csw_df['datetime'].dt.minute
csw_df['dayofweek'] = csw_df['datetime'].dt.dayofweek
csw_df
Out[37]:
link_avg_withoutNaN
date
hour
pressure
sea_pressure
wind_direction
wind_speed
temperature
rel_humidity
precipitation
datetime
minute
dayofweek
tw
link
2016-07-19 00:00:00
100
6.75
2016-07-19
0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
2016-07-19 00:00:00
0
1
101
2.38
2016-07-19
0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
2016-07-19 00:00:00
0
1
102
3.22
2016-07-19
0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
2016-07-19 00:00:00
0
1
103
7.47
2016-07-19
0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
2016-07-19 00:00:00
0
1
104
7.20
2016-07-19
0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
2016-07-19 00:00:00
0
1
105
9.56
2016-07-19
0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
2016-07-19 00:00:00
0
1
106
0.61
2016-07-19
0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
2016-07-19 00:00:00
0
1
107
3.12
2016-07-19
0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
2016-07-19 00:00:00
0
1
108
4.10
2016-07-19
0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
2016-07-19 00:00:00
0
1
109
2.99
2016-07-19
0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
2016-07-19 00:00:00
0
1
110
10.51
2016-07-19
0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
2016-07-19 00:00:00
0
1
111
13.00
2016-07-19
0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
2016-07-19 00:00:00
0
1
112
8.37
2016-07-19
0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
2016-07-19 00:00:00
0
1
113
6.25
2016-07-19
0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
2016-07-19 00:00:00
0
1
114
10.00
2016-07-19
0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
2016-07-19 00:00:00
0
1
115
3.67
2016-07-19
0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
2016-07-19 00:00:00
0
1
116
5.05
2016-07-19
0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
2016-07-19 00:00:00
0
1
117
22.89
2016-07-19
0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
2016-07-19 00:00:00
0
1
118
16.72
2016-07-19
0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
2016-07-19 00:00:00
0
1
119
0.51
2016-07-19
0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
2016-07-19 00:00:00
0
1
120
1.14
2016-07-19
0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
2016-07-19 00:00:00
0
1
121
7.03
2016-07-19
0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
2016-07-19 00:00:00
0
1
122
32.85
2016-07-19
0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
2016-07-19 00:00:00
0
1
123
5.39
2016-07-19
0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
2016-07-19 00:00:00
0
1
2016-07-19 00:20:00
100
5.15
2016-07-19
0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
2016-07-19 00:20:00
20
1
101
5.27
2016-07-19
0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
2016-07-19 00:20:00
20
1
102
3.33
2016-07-19
0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
2016-07-19 00:20:00
20
1
103
3.54
2016-07-19
0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
2016-07-19 00:20:00
20
1
104
6.97
2016-07-19
0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
2016-07-19 00:20:00
20
1
105
8.42
2016-07-19
0
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
2016-07-19 00:20:00
20
1
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
2016-10-17 21:20:00
118
32.08
2016-10-17
21
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
2016-10-17 21:20:00
20
0
119
0.91
2016-10-17
21
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
2016-10-17 21:20:00
20
0
120
0.89
2016-10-17
21
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
2016-10-17 21:20:00
20
0
121
11.92
2016-10-17
21
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
2016-10-17 21:20:00
20
0
122
28.64
2016-10-17
21
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
2016-10-17 21:20:00
20
0
123
6.32
2016-10-17
21
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
2016-10-17 21:20:00
20
0
2016-10-17 21:40:00
100
5.73
2016-10-17
21
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
2016-10-17 21:40:00
40
0
101
5.43
2016-10-17
21
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
2016-10-17 21:40:00
40
0
102
5.48
2016-10-17
21
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
2016-10-17 21:40:00
40
0
103
5.53
2016-10-17
21
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
2016-10-17 21:40:00
40
0
104
15.42
2016-10-17
21
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
2016-10-17 21:40:00
40
0
105
10.22
2016-10-17
21
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
2016-10-17 21:40:00
40
0
106
1.98
2016-10-17
21
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
2016-10-17 21:40:00
40
0
107
2.86
2016-10-17
21
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
2016-10-17 21:40:00
40
0
108
3.78
2016-10-17
21
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
2016-10-17 21:40:00
40
0
109
5.26
2016-10-17
21
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
2016-10-17 21:40:00
40
0
110
12.04
2016-10-17
21
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
2016-10-17 21:40:00
40
0
111
23.38
2016-10-17
21
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
2016-10-17 21:40:00
40
0
112
16.39
2016-10-17
21
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
2016-10-17 21:40:00
40
0
113
16.83
2016-10-17
21
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
2016-10-17 21:40:00
40
0
114
16.29
2016-10-17
21
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
2016-10-17 21:40:00
40
0
115
5.53
2016-10-17
21
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
2016-10-17 21:40:00
40
0
116
13.49
2016-10-17
21
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
2016-10-17 21:40:00
40
0
117
15.55
2016-10-17
21
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
2016-10-17 21:40:00
40
0
118
21.08
2016-10-17
21
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
2016-10-17 21:40:00
40
0
119
0.73
2016-10-17
21
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
2016-10-17 21:40:00
40
0
120
0.73
2016-10-17
21
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
2016-10-17 21:40:00
40
0
121
12.75
2016-10-17
21
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
2016-10-17 21:40:00
40
0
122
39.02
2016-10-17
21
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
2016-10-17 21:40:00
40
0
123
4.40
2016-10-17
21
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
2016-10-17 21:40:00
40
0
157104 rows × 13 columns
In [42]:
csw_df = csw_df[['dayofweek', 'hour', 'minute', 'link_avg_withoutNaN', 'pressure', 'sea_pressure',
'wind_direction', 'wind_speed', 'temperature', 'rel_humidity', 'precipitation']]
csw_df
Out[42]:
dayofweek
hour
minute
link_avg_withoutNaN
pressure
sea_pressure
wind_direction
wind_speed
temperature
rel_humidity
precipitation
tw
link
2016-07-19 00:00:00
100
1
0
0
6.75
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
101
1
0
0
2.38
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
102
1
0
0
3.22
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
103
1
0
0
7.47
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
104
1
0
0
7.20
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
105
1
0
0
9.56
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
106
1
0
0
0.61
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
107
1
0
0
3.12
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
108
1
0
0
4.10
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
109
1
0
0
2.99
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
110
1
0
0
10.51
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
111
1
0
0
13.00
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
112
1
0
0
8.37
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
113
1
0
0
6.25
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
114
1
0
0
10.00
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
115
1
0
0
3.67
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
116
1
0
0
5.05
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
117
1
0
0
22.89
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
118
1
0
0
16.72
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
119
1
0
0
0.51
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
120
1
0
0
1.14
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
121
1
0
0
7.03
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
122
1
0
0
32.85
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
123
1
0
0
5.39
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
2016-07-19 00:20:00
100
1
0
20
5.15
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
101
1
0
20
5.27
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
102
1
0
20
3.33
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
103
1
0
20
3.54
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
104
1
0
20
6.97
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
105
1
0
20
8.42
1000.9
1005.8
3.3
3.3
27.5
81.0
0.0
...
...
...
...
...
...
...
...
...
...
...
...
...
2016-10-17 21:20:00
118
0
21
20
32.08
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
119
0
21
20
0.91
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
120
0
21
20
0.89
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
121
0
21
20
11.92
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
122
0
21
20
28.64
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
123
0
21
20
6.32
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
2016-10-17 21:40:00
100
0
21
40
5.73
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
101
0
21
40
5.43
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
102
0
21
40
5.48
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
103
0
21
40
5.53
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
104
0
21
40
15.42
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
105
0
21
40
10.22
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
106
0
21
40
1.98
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
107
0
21
40
2.86
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
108
0
21
40
3.78
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
109
0
21
40
5.26
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
110
0
21
40
12.04
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
111
0
21
40
23.38
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
112
0
21
40
16.39
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
113
0
21
40
16.83
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
114
0
21
40
16.29
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
115
0
21
40
5.53
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
116
0
21
40
13.49
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
117
0
21
40
15.55
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
118
0
21
40
21.08
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
119
0
21
40
0.73
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
120
0
21
40
0.73
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
121
0
21
40
12.75
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
122
0
21
40
39.02
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
123
0
21
40
4.40
1013.9
1018.9
2.5
2.5
19.3
90.0
0.0
157104 rows × 11 columns
In [49]:
X = np.array(csw_df)
X = X.reshape((len(csw_df.columns) * len(csw_df), 1))
X
Out[49]:
array([[ 1. ],
[ 0. ],
[ 0. ],
...,
[ 19.3],
[ 90. ],
[ 0. ]])
In [5]:
def prepare_df_travelseq(df):
'''
splits the travel_seq
Returns: a df with ['trajectorie', 'itersection_id', 'tollgate_id', 'vehicle_id',
'starting_time', 'travel_seq', 'travel_time', 'link',
'link_starting_time', 'link_travel_time'] as coloumns
@author: Christian
'''
df_seq = df.travel_seq.str.split(';', expand=True)
df = df.join(df_seq)
# iterate... the slow way... :-/
mylist = []
for index, row in df.iterrows():
new_row = [index]
new_row.extend(row[:6])
# print(new_row)
for ele in row[6:]:
if ele is not None:
row_tmp = ele.split('#')
res_row = list(new_row)
res_row.extend(row_tmp)
# print(res_row)
mylist.append(res_row)
res_columns = ['trajectorie', 'intersection_id', 'tollgate_id', 'vehicle_id', 'starting_time', 'travel_seq', 'travel_time']
res_columns.extend(['link', 'link_starting_time', 'link_travel_time'])
link_df = pd.DataFrame(mylist, columns=res_columns)
return link_df
In [6]:
df = prepare_df_travelseq(trajectories_df)
df
Out[6]:
trajectorie
intersection_id
tollgate_id
vehicle_id
starting_time
travel_seq
travel_time
link
link_starting_time
link_travel_time
0
0
B
3
1065642
2016-07-19 00:14:24
105#2016-07-19 00:14:24#9.56;100#2016-07-19 00...
70.85
105
2016-07-19 00:14:24
9.56
1
0
B
3
1065642
2016-07-19 00:14:24
105#2016-07-19 00:14:24#9.56;100#2016-07-19 00...
70.85
100
2016-07-19 00:14:34
6.75
2
0
B
3
1065642
2016-07-19 00:14:24
105#2016-07-19 00:14:24#9.56;100#2016-07-19 00...
70.85
111
2016-07-19 00:14:41
13.00
3
0
B
3
1065642
2016-07-19 00:14:24
105#2016-07-19 00:14:24#9.56;100#2016-07-19 00...
70.85
103
2016-07-19 00:14:54
7.47
4
0
B
3
1065642
2016-07-19 00:14:24
105#2016-07-19 00:14:24#9.56;100#2016-07-19 00...
70.85
122
2016-07-19 00:15:02
32.85
5
1
B
3
1047198
2016-07-19 00:35:56
105#2016-07-19 00:35:56#11.58;100#2016-07-19 0...
148.79
105
2016-07-19 00:35:56
11.58
6
1
B
3
1047198
2016-07-19 00:35:56
105#2016-07-19 00:35:56#11.58;100#2016-07-19 0...
148.79
100
2016-07-19 00:36:08
7.44
7
1
B
3
1047198
2016-07-19 00:35:56
105#2016-07-19 00:35:56#11.58;100#2016-07-19 0...
148.79
111
2016-07-19 00:36:15
16.23
8
1
B
3
1047198
2016-07-19 00:35:56
105#2016-07-19 00:35:56#11.58;100#2016-07-19 0...
148.79
103
2016-07-19 00:36:32
5.95
9
1
B
3
1047198
2016-07-19 00:35:56
105#2016-07-19 00:35:56#11.58;100#2016-07-19 0...
148.79
122
2016-07-19 00:36:40
104.79
10
2
B
1
1086390
2016-07-19 00:37:15
105#2016-07-19 00:37:15#5.26;100#2016-07-19 00...
79.76
105
2016-07-19 00:37:15
5.26
11
2
B
1
1086390
2016-07-19 00:37:15
105#2016-07-19 00:37:15#5.26;100#2016-07-19 00...
79.76
100
2016-07-19 00:37:20
2.85
12
2
B
1
1086390
2016-07-19 00:37:15
105#2016-07-19 00:37:15#5.26;100#2016-07-19 00...
79.76
111
2016-07-19 00:37:23
5.94
13
2
B
1
1086390
2016-07-19 00:37:15
105#2016-07-19 00:37:15#5.26;100#2016-07-19 00...
79.76
103
2016-07-19 00:37:29
1.13
14
2
B
1
1086390
2016-07-19 00:37:15
105#2016-07-19 00:37:15#5.26;100#2016-07-19 00...
79.76
116
2016-07-19 00:37:30
10.07
15
2
B
1
1086390
2016-07-19 00:37:15
105#2016-07-19 00:37:15#5.26;100#2016-07-19 00...
79.76
101
2016-07-19 00:37:40
5.27
16
2
B
1
1086390
2016-07-19 00:37:15
105#2016-07-19 00:37:15#5.26;100#2016-07-19 00...
79.76
121
2016-07-19 00:37:46
25.51
17
2
B
1
1086390
2016-07-19 00:37:15
105#2016-07-19 00:37:15#5.26;100#2016-07-19 00...
79.76
106
2016-07-19 00:38:11
3.42
18
2
B
1
1086390
2016-07-19 00:37:15
105#2016-07-19 00:37:15#5.26;100#2016-07-19 00...
79.76
113
2016-07-19 00:38:15
19.76
19
3
A
2
1071181
2016-07-19 00:37:59
110#2016-07-19 00:37:59#13.74;123#2016-07-19 0...
58.05
110
2016-07-19 00:37:59
13.74
20
3
A
2
1071181
2016-07-19 00:37:59
110#2016-07-19 00:37:59#13.74;123#2016-07-19 0...
58.05
123
2016-07-19 00:38:13
4.70
21
3
A
2
1071181
2016-07-19 00:37:59
110#2016-07-19 00:37:59#13.74;123#2016-07-19 0...
58.05
107
2016-07-19 00:38:17
6.63
22
3
A
2
1071181
2016-07-19 00:37:59
110#2016-07-19 00:37:59#13.74;123#2016-07-19 0...
58.05
108
2016-07-19 00:38:24
4.95
23
3
A
2
1071181
2016-07-19 00:37:59
110#2016-07-19 00:37:59#13.74;123#2016-07-19 0...
58.05
120
2016-07-19 00:38:29
0.74
24
3
A
2
1071181
2016-07-19 00:37:59
110#2016-07-19 00:37:59#13.74;123#2016-07-19 0...
58.05
117
2016-07-19 00:38:30
27.05
25
4
B
1
1065807
2016-07-19 00:56:21
105#2016-07-19 00:56:21#16.08;100#2016-07-19 0...
137.98
105
2016-07-19 00:56:21
16.08
26
4
B
1
1065807
2016-07-19 00:56:21
105#2016-07-19 00:56:21#16.08;100#2016-07-19 0...
137.98
100
2016-07-19 00:56:37
12.34
27
4
B
1
1065807
2016-07-19 00:56:21
105#2016-07-19 00:56:21#16.08;100#2016-07-19 0...
137.98
111
2016-07-19 00:56:49
25.75
28
4
B
1
1065807
2016-07-19 00:56:21
105#2016-07-19 00:56:21#16.08;100#2016-07-19 0...
137.98
103
2016-07-19 00:57:15
4.89
29
4
B
1
1065807
2016-07-19 00:56:21
105#2016-07-19 00:56:21#16.08;100#2016-07-19 0...
137.98
116
2016-07-19 00:57:21
38.30
...
...
...
...
...
...
...
...
...
...
...
763538
109240
A
2
1051052
2016-10-17 23:40:19
110#2016-10-17 23:40:19#11.87;123#2016-10-17 2...
42.27
110
2016-10-17 23:40:19
11.87
763539
109240
A
2
1051052
2016-10-17 23:40:19
110#2016-10-17 23:40:19#11.87;123#2016-10-17 2...
42.27
123
2016-10-17 23:40:31
5.42
763540
109240
A
2
1051052
2016-10-17 23:40:19
110#2016-10-17 23:40:19#11.87;123#2016-10-17 2...
42.27
107
2016-10-17 23:40:37
3.92
763541
109240
A
2
1051052
2016-10-17 23:40:19
110#2016-10-17 23:40:19#11.87;123#2016-10-17 2...
42.27
108
2016-10-17 23:40:41
4.00
763542
109240
A
2
1051052
2016-10-17 23:40:19
110#2016-10-17 23:40:19#11.87;123#2016-10-17 2...
42.27
120
2016-10-17 23:40:45
0.60
763543
109240
A
2
1051052
2016-10-17 23:40:19
110#2016-10-17 23:40:19#11.87;123#2016-10-17 2...
42.27
117
2016-10-17 23:40:45
16.27
763544
109241
A
3
1003251
2016-10-17 23:52:18
110#2016-10-17 23:52:18#7.59;123#2016-10-17 23...
71.94
110
2016-10-17 23:52:18
7.59
763545
109241
A
3
1003251
2016-10-17 23:52:18
110#2016-10-17 23:52:18#7.59;123#2016-10-17 23...
71.94
123
2016-10-17 23:52:26
4.11
763546
109241
A
3
1003251
2016-10-17 23:52:18
110#2016-10-17 23:52:18#7.59;123#2016-10-17 23...
71.94
107
2016-10-17 23:52:30
2.37
763547
109241
A
3
1003251
2016-10-17 23:52:18
110#2016-10-17 23:52:18#7.59;123#2016-10-17 23...
71.94
108
2016-10-17 23:52:32
2.78
763548
109241
A
3
1003251
2016-10-17 23:52:18
110#2016-10-17 23:52:18#7.59;123#2016-10-17 23...
71.94
119
2016-10-17 23:52:35
0.63
763549
109241
A
3
1003251
2016-10-17 23:52:18
110#2016-10-17 23:52:18#7.59;123#2016-10-17 23...
71.94
114
2016-10-17 23:52:36
15.16
763550
109241
A
3
1003251
2016-10-17 23:52:18
110#2016-10-17 23:52:18#7.59;123#2016-10-17 23...
71.94
118
2016-10-17 23:52:51
18.23
763551
109241
A
3
1003251
2016-10-17 23:52:18
110#2016-10-17 23:52:18#7.59;123#2016-10-17 23...
71.94
122
2016-10-17 23:53:09
20.94
763552
109242
A
3
1041002
2016-10-17 23:53:57
110#2016-10-17 23:53:57#10.56;123#2016-10-17 2...
132.51
110
2016-10-17 23:53:57
10.56
763553
109242
A
3
1041002
2016-10-17 23:53:57
110#2016-10-17 23:53:57#10.56;123#2016-10-17 2...
132.51
123
2016-10-17 23:54:07
4.02
763554
109242
A
3
1041002
2016-10-17 23:53:57
110#2016-10-17 23:53:57#10.56;123#2016-10-17 2...
132.51
107
2016-10-17 23:54:11
2.28
763555
109242
A
3
1041002
2016-10-17 23:53:57
110#2016-10-17 23:53:57#10.56;123#2016-10-17 2...
132.51
108
2016-10-17 23:54:14
4.17
763556
109242
A
3
1041002
2016-10-17 23:53:57
110#2016-10-17 23:53:57#10.56;123#2016-10-17 2...
132.51
119
2016-10-17 23:54:18
1.44
763557
109242
A
3
1041002
2016-10-17 23:53:57
110#2016-10-17 23:53:57#10.56;123#2016-10-17 2...
132.51
114
2016-10-17 23:54:19
62.86
763558
109242
A
3
1041002
2016-10-17 23:53:57
110#2016-10-17 23:53:57#10.56;123#2016-10-17 2...
132.51
118
2016-10-17 23:55:22
22.62
763559
109242
A
3
1041002
2016-10-17 23:53:57
110#2016-10-17 23:53:57#10.56;123#2016-10-17 2...
132.51
122
2016-10-17 23:55:45
24.51
763560
109243
A
3
1017582
2016-10-17 23:54:35
110#2016-10-17 23:54:35#9.10;123#2016-10-17 23...
137.38
110
2016-10-17 23:54:35
9.10
763561
109243
A
3
1017582
2016-10-17 23:54:35
110#2016-10-17 23:54:35#9.10;123#2016-10-17 23...
137.38
123
2016-10-17 23:54:44
5.36
763562
109243
A
3
1017582
2016-10-17 23:54:35
110#2016-10-17 23:54:35#9.10;123#2016-10-17 23...
137.38
107
2016-10-17 23:54:50
3.09
763563
109243
A
3
1017582
2016-10-17 23:54:35
110#2016-10-17 23:54:35#9.10;123#2016-10-17 23...
137.38
108
2016-10-17 23:54:53
3.64
763564
109243
A
3
1017582
2016-10-17 23:54:35
110#2016-10-17 23:54:35#9.10;123#2016-10-17 23...
137.38
119
2016-10-17 23:54:56
0.82
763565
109243
A
3
1017582
2016-10-17 23:54:35
110#2016-10-17 23:54:35#9.10;123#2016-10-17 23...
137.38
114
2016-10-17 23:54:57
18.00
763566
109243
A
3
1017582
2016-10-17 23:54:35
110#2016-10-17 23:54:35#9.10;123#2016-10-17 23...
137.38
118
2016-10-17 23:55:15
18.73
763567
109243
A
3
1017582
2016-10-17 23:54:35
110#2016-10-17 23:54:35#9.10;123#2016-10-17 23...
137.38
122
2016-10-17 23:55:34
78.38
763568 rows × 10 columns
In [7]:
#add tw, needed to merge
def add_tw(x):
minute = x.minute
tw_minute = -1
if minute < 20:
tw_minute = 0
elif minute < 40:
tw_minute = 20
elif minute <= 60:
tw_minute = 40
return x.replace(minute=tw_minute, second=0)
# add tw
df['link_starting_time'] = pd.to_datetime(df['link_starting_time'])
df['tw'] = df['link_starting_time'].apply(lambda x: add_tw(x))
df['tw'] = pd.to_datetime(df['tw'])
# set as numeris
df['link_travel_time'] = pd.to_numeric(df['link_travel_time'])
# set as string (Object)
df['link'] = df['link'].astype(str)
df
Out[7]:
trajectorie
intersection_id
tollgate_id
vehicle_id
starting_time
travel_seq
travel_time
link
link_starting_time
link_travel_time
tw
0
0
B
3
1065642
2016-07-19 00:14:24
105#2016-07-19 00:14:24#9.56;100#2016-07-19 00...
70.85
105
2016-07-19 00:14:24
9.56
2016-07-19 00:00:00
1
0
B
3
1065642
2016-07-19 00:14:24
105#2016-07-19 00:14:24#9.56;100#2016-07-19 00...
70.85
100
2016-07-19 00:14:34
6.75
2016-07-19 00:00:00
2
0
B
3
1065642
2016-07-19 00:14:24
105#2016-07-19 00:14:24#9.56;100#2016-07-19 00...
70.85
111
2016-07-19 00:14:41
13.00
2016-07-19 00:00:00
3
0
B
3
1065642
2016-07-19 00:14:24
105#2016-07-19 00:14:24#9.56;100#2016-07-19 00...
70.85
103
2016-07-19 00:14:54
7.47
2016-07-19 00:00:00
4
0
B
3
1065642
2016-07-19 00:14:24
105#2016-07-19 00:14:24#9.56;100#2016-07-19 00...
70.85
122
2016-07-19 00:15:02
32.85
2016-07-19 00:00:00
5
1
B
3
1047198
2016-07-19 00:35:56
105#2016-07-19 00:35:56#11.58;100#2016-07-19 0...
148.79
105
2016-07-19 00:35:56
11.58
2016-07-19 00:20:00
6
1
B
3
1047198
2016-07-19 00:35:56
105#2016-07-19 00:35:56#11.58;100#2016-07-19 0...
148.79
100
2016-07-19 00:36:08
7.44
2016-07-19 00:20:00
7
1
B
3
1047198
2016-07-19 00:35:56
105#2016-07-19 00:35:56#11.58;100#2016-07-19 0...
148.79
111
2016-07-19 00:36:15
16.23
2016-07-19 00:20:00
8
1
B
3
1047198
2016-07-19 00:35:56
105#2016-07-19 00:35:56#11.58;100#2016-07-19 0...
148.79
103
2016-07-19 00:36:32
5.95
2016-07-19 00:20:00
9
1
B
3
1047198
2016-07-19 00:35:56
105#2016-07-19 00:35:56#11.58;100#2016-07-19 0...
148.79
122
2016-07-19 00:36:40
104.79
2016-07-19 00:20:00
10
2
B
1
1086390
2016-07-19 00:37:15
105#2016-07-19 00:37:15#5.26;100#2016-07-19 00...
79.76
105
2016-07-19 00:37:15
5.26
2016-07-19 00:20:00
11
2
B
1
1086390
2016-07-19 00:37:15
105#2016-07-19 00:37:15#5.26;100#2016-07-19 00...
79.76
100
2016-07-19 00:37:20
2.85
2016-07-19 00:20:00
12
2
B
1
1086390
2016-07-19 00:37:15
105#2016-07-19 00:37:15#5.26;100#2016-07-19 00...
79.76
111
2016-07-19 00:37:23
5.94
2016-07-19 00:20:00
13
2
B
1
1086390
2016-07-19 00:37:15
105#2016-07-19 00:37:15#5.26;100#2016-07-19 00...
79.76
103
2016-07-19 00:37:29
1.13
2016-07-19 00:20:00
14
2
B
1
1086390
2016-07-19 00:37:15
105#2016-07-19 00:37:15#5.26;100#2016-07-19 00...
79.76
116
2016-07-19 00:37:30
10.07
2016-07-19 00:20:00
15
2
B
1
1086390
2016-07-19 00:37:15
105#2016-07-19 00:37:15#5.26;100#2016-07-19 00...
79.76
101
2016-07-19 00:37:40
5.27
2016-07-19 00:20:00
16
2
B
1
1086390
2016-07-19 00:37:15
105#2016-07-19 00:37:15#5.26;100#2016-07-19 00...
79.76
121
2016-07-19 00:37:46
25.51
2016-07-19 00:20:00
17
2
B
1
1086390
2016-07-19 00:37:15
105#2016-07-19 00:37:15#5.26;100#2016-07-19 00...
79.76
106
2016-07-19 00:38:11
3.42
2016-07-19 00:20:00
18
2
B
1
1086390
2016-07-19 00:37:15
105#2016-07-19 00:37:15#5.26;100#2016-07-19 00...
79.76
113
2016-07-19 00:38:15
19.76
2016-07-19 00:20:00
19
3
A
2
1071181
2016-07-19 00:37:59
110#2016-07-19 00:37:59#13.74;123#2016-07-19 0...
58.05
110
2016-07-19 00:37:59
13.74
2016-07-19 00:20:00
20
3
A
2
1071181
2016-07-19 00:37:59
110#2016-07-19 00:37:59#13.74;123#2016-07-19 0...
58.05
123
2016-07-19 00:38:13
4.70
2016-07-19 00:20:00
21
3
A
2
1071181
2016-07-19 00:37:59
110#2016-07-19 00:37:59#13.74;123#2016-07-19 0...
58.05
107
2016-07-19 00:38:17
6.63
2016-07-19 00:20:00
22
3
A
2
1071181
2016-07-19 00:37:59
110#2016-07-19 00:37:59#13.74;123#2016-07-19 0...
58.05
108
2016-07-19 00:38:24
4.95
2016-07-19 00:20:00
23
3
A
2
1071181
2016-07-19 00:37:59
110#2016-07-19 00:37:59#13.74;123#2016-07-19 0...
58.05
120
2016-07-19 00:38:29
0.74
2016-07-19 00:20:00
24
3
A
2
1071181
2016-07-19 00:37:59
110#2016-07-19 00:37:59#13.74;123#2016-07-19 0...
58.05
117
2016-07-19 00:38:30
27.05
2016-07-19 00:20:00
25
4
B
1
1065807
2016-07-19 00:56:21
105#2016-07-19 00:56:21#16.08;100#2016-07-19 0...
137.98
105
2016-07-19 00:56:21
16.08
2016-07-19 00:40:00
26
4
B
1
1065807
2016-07-19 00:56:21
105#2016-07-19 00:56:21#16.08;100#2016-07-19 0...
137.98
100
2016-07-19 00:56:37
12.34
2016-07-19 00:40:00
27
4
B
1
1065807
2016-07-19 00:56:21
105#2016-07-19 00:56:21#16.08;100#2016-07-19 0...
137.98
111
2016-07-19 00:56:49
25.75
2016-07-19 00:40:00
28
4
B
1
1065807
2016-07-19 00:56:21
105#2016-07-19 00:56:21#16.08;100#2016-07-19 0...
137.98
103
2016-07-19 00:57:15
4.89
2016-07-19 00:40:00
29
4
B
1
1065807
2016-07-19 00:56:21
105#2016-07-19 00:56:21#16.08;100#2016-07-19 0...
137.98
116
2016-07-19 00:57:21
38.30
2016-07-19 00:40:00
...
...
...
...
...
...
...
...
...
...
...
...
763538
109240
A
2
1051052
2016-10-17 23:40:19
110#2016-10-17 23:40:19#11.87;123#2016-10-17 2...
42.27
110
2016-10-17 23:40:19
11.87
2016-10-17 23:40:00
763539
109240
A
2
1051052
2016-10-17 23:40:19
110#2016-10-17 23:40:19#11.87;123#2016-10-17 2...
42.27
123
2016-10-17 23:40:31
5.42
2016-10-17 23:40:00
763540
109240
A
2
1051052
2016-10-17 23:40:19
110#2016-10-17 23:40:19#11.87;123#2016-10-17 2...
42.27
107
2016-10-17 23:40:37
3.92
2016-10-17 23:40:00
763541
109240
A
2
1051052
2016-10-17 23:40:19
110#2016-10-17 23:40:19#11.87;123#2016-10-17 2...
42.27
108
2016-10-17 23:40:41
4.00
2016-10-17 23:40:00
763542
109240
A
2
1051052
2016-10-17 23:40:19
110#2016-10-17 23:40:19#11.87;123#2016-10-17 2...
42.27
120
2016-10-17 23:40:45
0.60
2016-10-17 23:40:00
763543
109240
A
2
1051052
2016-10-17 23:40:19
110#2016-10-17 23:40:19#11.87;123#2016-10-17 2...
42.27
117
2016-10-17 23:40:45
16.27
2016-10-17 23:40:00
763544
109241
A
3
1003251
2016-10-17 23:52:18
110#2016-10-17 23:52:18#7.59;123#2016-10-17 23...
71.94
110
2016-10-17 23:52:18
7.59
2016-10-17 23:40:00
763545
109241
A
3
1003251
2016-10-17 23:52:18
110#2016-10-17 23:52:18#7.59;123#2016-10-17 23...
71.94
123
2016-10-17 23:52:26
4.11
2016-10-17 23:40:00
763546
109241
A
3
1003251
2016-10-17 23:52:18
110#2016-10-17 23:52:18#7.59;123#2016-10-17 23...
71.94
107
2016-10-17 23:52:30
2.37
2016-10-17 23:40:00
763547
109241
A
3
1003251
2016-10-17 23:52:18
110#2016-10-17 23:52:18#7.59;123#2016-10-17 23...
71.94
108
2016-10-17 23:52:32
2.78
2016-10-17 23:40:00
763548
109241
A
3
1003251
2016-10-17 23:52:18
110#2016-10-17 23:52:18#7.59;123#2016-10-17 23...
71.94
119
2016-10-17 23:52:35
0.63
2016-10-17 23:40:00
763549
109241
A
3
1003251
2016-10-17 23:52:18
110#2016-10-17 23:52:18#7.59;123#2016-10-17 23...
71.94
114
2016-10-17 23:52:36
15.16
2016-10-17 23:40:00
763550
109241
A
3
1003251
2016-10-17 23:52:18
110#2016-10-17 23:52:18#7.59;123#2016-10-17 23...
71.94
118
2016-10-17 23:52:51
18.23
2016-10-17 23:40:00
763551
109241
A
3
1003251
2016-10-17 23:52:18
110#2016-10-17 23:52:18#7.59;123#2016-10-17 23...
71.94
122
2016-10-17 23:53:09
20.94
2016-10-17 23:40:00
763552
109242
A
3
1041002
2016-10-17 23:53:57
110#2016-10-17 23:53:57#10.56;123#2016-10-17 2...
132.51
110
2016-10-17 23:53:57
10.56
2016-10-17 23:40:00
763553
109242
A
3
1041002
2016-10-17 23:53:57
110#2016-10-17 23:53:57#10.56;123#2016-10-17 2...
132.51
123
2016-10-17 23:54:07
4.02
2016-10-17 23:40:00
763554
109242
A
3
1041002
2016-10-17 23:53:57
110#2016-10-17 23:53:57#10.56;123#2016-10-17 2...
132.51
107
2016-10-17 23:54:11
2.28
2016-10-17 23:40:00
763555
109242
A
3
1041002
2016-10-17 23:53:57
110#2016-10-17 23:53:57#10.56;123#2016-10-17 2...
132.51
108
2016-10-17 23:54:14
4.17
2016-10-17 23:40:00
763556
109242
A
3
1041002
2016-10-17 23:53:57
110#2016-10-17 23:53:57#10.56;123#2016-10-17 2...
132.51
119
2016-10-17 23:54:18
1.44
2016-10-17 23:40:00
763557
109242
A
3
1041002
2016-10-17 23:53:57
110#2016-10-17 23:53:57#10.56;123#2016-10-17 2...
132.51
114
2016-10-17 23:54:19
62.86
2016-10-17 23:40:00
763558
109242
A
3
1041002
2016-10-17 23:53:57
110#2016-10-17 23:53:57#10.56;123#2016-10-17 2...
132.51
118
2016-10-17 23:55:22
22.62
2016-10-17 23:40:00
763559
109242
A
3
1041002
2016-10-17 23:53:57
110#2016-10-17 23:53:57#10.56;123#2016-10-17 2...
132.51
122
2016-10-17 23:55:45
24.51
2016-10-17 23:40:00
763560
109243
A
3
1017582
2016-10-17 23:54:35
110#2016-10-17 23:54:35#9.10;123#2016-10-17 23...
137.38
110
2016-10-17 23:54:35
9.10
2016-10-17 23:40:00
763561
109243
A
3
1017582
2016-10-17 23:54:35
110#2016-10-17 23:54:35#9.10;123#2016-10-17 23...
137.38
123
2016-10-17 23:54:44
5.36
2016-10-17 23:40:00
763562
109243
A
3
1017582
2016-10-17 23:54:35
110#2016-10-17 23:54:35#9.10;123#2016-10-17 23...
137.38
107
2016-10-17 23:54:50
3.09
2016-10-17 23:40:00
763563
109243
A
3
1017582
2016-10-17 23:54:35
110#2016-10-17 23:54:35#9.10;123#2016-10-17 23...
137.38
108
2016-10-17 23:54:53
3.64
2016-10-17 23:40:00
763564
109243
A
3
1017582
2016-10-17 23:54:35
110#2016-10-17 23:54:35#9.10;123#2016-10-17 23...
137.38
119
2016-10-17 23:54:56
0.82
2016-10-17 23:40:00
763565
109243
A
3
1017582
2016-10-17 23:54:35
110#2016-10-17 23:54:35#9.10;123#2016-10-17 23...
137.38
114
2016-10-17 23:54:57
18.00
2016-10-17 23:40:00
763566
109243
A
3
1017582
2016-10-17 23:54:35
110#2016-10-17 23:54:35#9.10;123#2016-10-17 23...
137.38
118
2016-10-17 23:55:15
18.73
2016-10-17 23:40:00
763567
109243
A
3
1017582
2016-10-17 23:54:35
110#2016-10-17 23:54:35#9.10;123#2016-10-17 23...
137.38
122
2016-10-17 23:55:34
78.38
2016-10-17 23:40:00
763568 rows × 11 columns
In [8]:
# create multi_index
import datetime
# get daterange
date_start = df['starting_time'].min()
date_end = df['starting_time'].max()
# enddate is next day midnight #normalize=True sets it to midnight
date_end = pd.to_datetime(date_end) + datetime.timedelta(days=1)
daterange = pd.date_range(start=date_start, end=date_end, normalize=True, closed='left', freq='20min')
# route_tuples
route_touples = [('A', 2), ('A', 3), ('B', 1), ('B', 3), ('C', 1), ('C', 3)]
# links (24)
links = list(range(100, 123+1))
links = np.array(links).astype('str') # as string
#generate index touples (slow way)
tuples = []
for tw in daterange:
for link in links:
tuples.append((tw, link))
multi_index = pd.MultiIndex.from_tuples(tuples, names=['tw', 'link'])
In [9]:
# set same index to set multiindex
df_tmp = df
# calculate the avg of link travel time
df_tmp = df_tmp[['tw', 'link', 'link_travel_time']]
df_tmp = df_tmp.groupby(['tw', 'link'], as_index=False)['link_travel_time'].mean()
df_tmp.dtypes
Out[9]:
tw datetime64[ns]
link object
link_travel_time float64
dtype: object
In [10]:
df2 = pd.DataFrame(df_tmp.set_index(['tw', 'link']), index=multi_index, columns=[['link_travel_time']])
df2
Out[10]:
link_travel_time
tw
link
2016-07-19 00:00:00
100
6.750000
101
NaN
102
NaN
103
7.470000
104
NaN
105
9.560000
106
NaN
107
NaN
108
NaN
109
NaN
110
NaN
111
13.000000
112
NaN
113
NaN
114
NaN
115
NaN
116
NaN
117
NaN
118
NaN
119
NaN
120
NaN
121
NaN
122
32.850000
123
NaN
2016-07-19 00:20:00
100
5.145000
101
5.270000
102
NaN
103
3.540000
104
NaN
105
8.420000
...
...
...
2016-10-17 23:20:00
118
47.955000
119
0.770000
120
1.332000
121
13.615000
122
66.713333
123
7.560000
2016-10-17 23:40:00
100
NaN
101
NaN
102
NaN
103
NaN
104
NaN
105
NaN
106
NaN
107
2.915000
108
3.647500
109
NaN
110
9.780000
111
NaN
112
NaN
113
NaN
114
32.006667
115
NaN
116
NaN
117
16.270000
118
19.860000
119
0.963333
120
0.600000
121
NaN
122
41.276667
123
4.727500
157248 rows × 1 columns
In [ ]:
In [7]:
import src.vector_gen.generateWeatherVectors as gwv
X, Y = gwv.generate_timeInformationVectors(trajectories_df)
Out[7]:
(array([ 1, 0, 0, ..., 0, 21, 40], dtype=int64),
[37.09,
35.27,
15.58,
67.81,
8.36,
17.12,
42.64,
77.61,
10.38,
25.51,
24.81,
11.66,
40.17,
29.3,
13.44,
167.55,
20.74,
7.62,
39.12,
93.09,
17.06,
36.47,
14.96,
17.62,
41.92,
32.12,
11.06,
31.36,
13.87,
11.76,
39.43,
46.12,
12.01,
98.49,
12.14,
7.78,
48.13,
45.88,
9.91,
96.67,
15.55,
9.84,
62.11,
40.29,
94.06,
53.15,
13.01,
5.96,
46.12,
91.61,
21.78,
55.25,
187.3,
13.68,
49.56,
59.57,
23.47,
209.66,
27.57,
16.12,
54.84,
168.36,
66.98,
48.19,
30.07,
26.15,
58.08,
70.58,
87.83,
48.22,
67.51,
33.0,
46.36,
124.66,
170.09,
145.94,
160.38,
42.83,
48.59,
89.85,
64.27,
127.35,
80.44,
161.74,
66.64,
180.02,
132.96,
97.2,
134.56,
223.81,
64.68,
101.39,
65.41,
118.43,
100.86,
135.92,
85.68,
124.29,
73.54,
82.63,
92.15,
236.12,
58.97,
155.49,
69.42,
110.5,
180.11,
60.6,
81.6,
137.38,
97.06,
125.76,
151.39,
120.73,
80.21,
165.48,
128.75,
141.33,
129.1,
143.37,
63.45,
136.68,
71.89,
176.08,
135.18,
113.52,
78.05,
192.68,
177.11,
165.29,
200.87,
110.91,
69.04,
159.78,
104.33,
127.38,
164.52,
104.67,
69.66,
129.28,
87.74,
117.83,
132.77,
139.7,
78.31,
99.04,
132.68,
98.92,
200.92,
139.7,
59.41,
129.3,
170.59,
113.0,
203.88,
114.25,
75.49,
121.1,
79.57,
98.15,
301.28,
96.47,
72.44,
104.79,
54.46,
95.98,
42.95,
95.84,
45.94,
82.08,
74.9,
84.36,
195.16,
93.07,
47.98,
86.68,
80.95,
96.54,
182.46,
88.35,
60.17,
108.74,
145.29,
144.87,
142.74,
91.15,
49.53,
95.43,
71.36,
136.36,
195.28,
99.65,
52.17,
96.38,
23.19,
129.5,
161.59,
225.1,
57.83,
99.29,
77.87,
116.47,
121.32,
117.54,
57.09,
93.23,
140.65,
119.37,
172.16,
180.09,
61.13,
102.92,
99.61,
176.65,
117.03,
140.79,
65.11,
96.92,
179.98,
159.46,
147.6,
174.84,
74.71,
101.41,
160.78,
129.48,
156.08,
191.57,
63.83,
100.74,
67.3,
120.24,
137.45,
222.44,
79.42,
106.76,
75.41,
115.29,
144.53,
156.1,
72.31,
102.51,
163.81,
129.47,
257.2,
185.51,
58.74,
112.32,
90.01,
120.76,
137.86,
125.78,
59.64,
126.61,
78.76,
116.07,
144.7,
183.07,
51.97,
95.45,
105.64,
152.5,
176.54,
249.18,
61.6,
116.14,
122.31,
101.66,
150.56,
95.5,
105.39,
182.46,
76.89,
139.36,
173.78,
100.09,
83.83,
114.1,
66.65,
103.67,
192.5,
172.78,
65.67,
102.47,
82.13,
109.3,
141.04,
203.77,
85.11,
99.14,
77.42,
108.3,
202.21,
134.43,
50.57,
109.12,
382.03,
91.94,
360.56,
254.01,
65.07,
132.73,
71.62,
106.92,
168.36,
176.96,
67.33,
108.42,
295.31,
105.06,
227.46,
208.12,
79.85,
121.27,
62.14,
115.99,
83.93,
219.38,
89.64,
128.92,
115.0,
209.49,
83.93,
90.56,
87.94,
113.02,
128.65,
112.25,
164.91,
72.64,
44.09,
105.55,
59.01,
84.75,
82.55,
265.64,
64.16,
106.33,
63.5,
96.82,
90.04,
82.35,
68.48,
115.59,
134.46,
76.62,
118.83,
184.96,
59.09,
106.2,
155.63,
133.02,
114.64,
65.92,
51.18,
108.17,
129.93,
96.96,
74.71,
185.62,
46.09,
141.25,
35.65,
149.31,
83.33,
51.67,
91.85,
87.91,
37.17,
100.55,
56.17,
50.18,
47.02,
91.36,
28.32,
55.57,
283.51,
33.29,
54.59,
72.08,
25.26,
97.07,
51.21,
35.69,
84.37,
71.52,
32.59,
61.42,
28.59,
285.82,
67.96,
85.08,
23.5,
121.11,
35.92,
21.77,
46.02,
81.05,
18.62,
50.16,
38.5,
27.91,
37.89,
62.65,
16.13,
45.35,
31.82,
35.69,
83.66,
52.42,
20.93,
26.84,
34.06,
14.43,
57.64,
44.22,
21.53,
93.17,
33.54,
17.79,
58.62,
93.17,
20.83,
39.41,
135.02,
16.2,
40.75,
107.08,
9.92,
33.25,
18.98,
8.17,
49.12,
35.27,
15.58,
28.74,
8.36,
17.12,
18.68,
82.09,
10.38,
127.48,
24.81,
11.66,
33.89,
29.3,
88.45,
157.13,
20.74,
7.62,
60.67,
40.93,
17.06,
125.75,
185.46,
17.62,
18.59,
99.87,
11.06,
104.71,
13.87,
11.76,
100.71,
46.12,
12.01,
148.14,
12.14,
7.78,
105.65,
144.06,
9.91,
113.72,
15.55,
9.84,
64.32,
77.24,
30.23,
129.63,
13.01,
5.96,
49.4,
64.33,
21.78,
59.88,
18.07,
164.88,
49.76,
59.57,
23.47,
37.74,
27.57,
16.12,
57.67,
99.32,
22.54,
48.19,
30.07,
26.15,
46.2,
151.55,
36.27,
48.22,
67.51,
125.32,
44.1,
97.48,
122.68,
112.36,
74.69,
42.83,
59.87,
102.5,
67.35,
386.44,
80.44,
40.54,
88.81,
81.85,
179.51,
130.59,
98.24,
26.9,
77.85,
142.06,
137.82,
122.35,
280.71,
223.97,
94.92,
138.41,
98.2,
133.2,
92.15,
424.79,
73.68,
128.13,
94.11,
137.98,
130.56,
175.09,
61.01,
140.36,
212.31,
182.66,
237.4,
155.16,
332.16,
192.68,
81.16,
127.68,
305.51,
273.14,
50.99,
276.98,
89.18,
134.42,
152.86,
229.15,
44.94,
242.86,
151.44,
114.74,
276.13,
110.91,
79.01,
269.83,
115.11,
142.06,
199.87,
104.67,
23.3,
250.81,
155.41,
170.11,
171.96,
102.43,
341.79,
175.94,
107.35,
103.82,
228.74,
221.42,
70.14,
118.92,
91.98,
146.52,
121.35,
98.73,
90.17,
127.88,
84.05,
119.25,
168.86,
150.61,
49.45,
89.53,
102.92,
126.27,
122.63,
248.62,
46.64,
143.12,
74.9,
157.7,
117.66,
202.93,
60.48,
107.66,
98.2,
80.52,
125.28,
111.24,
53.99,
105.16,
76.36,
111.79,
187.53,
91.15,
49.55,
109.57,
91.31,
47.27,
161.44,
196.63,
55.28,
129.93,
79.78,
82.82,
158.82,
127.38,
81.49,
97.96,
162.35,
117.0,
131.6,
226.95,
50.82,
128.07,
89.11,
65.45,
147.59,
123.63,
73.5,
99.35,
231.91,
127.1,
154.89,
164.01,
66.64,
115.73,
155.33,
95.36,
147.6,
203.2,
57.33,
112.98,
159.89,
110.72,
105.8,
186.64,
53.57,
141.37,
215.22,
128.78,
211.53,
246.2,
62.18,
129.46,
146.8,
54.23,
179.21,
120.97,
64.33,
77.27,
90.47,
134.65,
166.11,
203.75,
70.33,
116.61,
71.68,
174.75,
215.74,
125.78,
67.11,
87.68,
144.83,
130.69,
105.2,
159.47,
82.79,
126.26,
80.05,
98.28,
215.61,
313.93,
52.87,
124.92,
76.44,
98.73,
124.97,
168.69,
50.17,
108.08,
76.89,
114.94,
248.15,
179.45,
81.35,
168.57,
66.65,
131.36,
125.53,
148.84,
75.48,
123.79,
82.13,
134.24,
175.44,
214.36,
67.89,
114.3,
77.42,
101.55,
213.84,
200.78,
85.11,
102.69,
69.72,
113.77,
119.99,
137.7,
78.33,
202.54,
71.62,
89.67,
154.72,
147.84,
93.49,
140.05,
108.59,
114.53,
165.56,
99.04,
56.44,
149.03,
62.14,
90.8,
257.77,
131.43,
52.1,
137.11,
52.3,
103.43,
263.1,
234.9,
57.61,
116.09,
115.93,
91.33,
205.59,
72.64,
52.58,
113.43,
59.01,
156.44,
82.55,
84.86,
123.65,
115.26,
107.49,
78.35,
90.04,
281.13,
80.38,
427.92,
64.96,
85.88,
118.83,
262.98,
50.84,
102.57,
61.55,
86.44,
205.68,
65.92,
68.68,
110.21,
46.81,
111.47,
162.6,
158.17,
55.45,
108.71,
121.78,
91.52,
150.18,
185.89,
44.94,
88.03,
37.17,
62.19,
56.17,
50.18,
66.24,
145.52,
28.32,
55.57,
65.62,
33.29,
49.75,
72.08,
25.26,
137.86,
177.96,
35.69,
55.15,
98.78,
32.59,
61.42,
167.24,
34.71,
56.67,
80.57,
23.5,
112.89,
35.92,
21.77,
39.21,
82.98,
18.62,
85.0,
38.5,
27.91,
36.43,
95.15,
16.13,
45.35,
31.82,
160.84,
40.39,
52.42,
20.93,
26.84,
34.06,
14.43,
56.27,
44.22,
21.53,
43.74,
33.54,
17.79,
41.47,
37.04,
20.83,
65.78,
21.36,
16.2,
80.25,
45.09,
9.92,
22.18,
18.98,
8.17,
45.19,
35.27,
15.58,
28.74,
8.36,
17.12,
28.59,
35.2,
10.38,
25.51,
146.28,
11.66,
54.09,
29.3,
13.44,
29.14,
20.74,
7.62,
47.21,
40.93,
17.06,
36.47,
195.28,
17.62,
50.25,
75.54,
11.06,
31.36,
13.87,
11.76,
83.48,
46.12,
12.01,
29.13,
12.14,
7.78,
51.53,
90.69,
9.91,
23.75,
15.55,
9.84,
49.89,
40.29,
93.61,
393.05,
13.01,
5.96,
61.71,
64.33,
21.78,
36.79,
18.07,
13.68,
48.06,
59.57,
23.47,
37.74,
27.57,
16.12,
39.5,
88.4,
22.54,
48.19,
30.07,
26.15,
56.69,
133.45,
36.27,
48.22,
67.51,
33.0,
63.18,
86.8,
56.34,
166.81,
218.35,
42.83,
87.03,
94.82,
64.27,
136.67,
80.44,
181.13,
65.34,
73.19,
170.21,
55.92,
98.24,
26.9,
78.01,
186.26,
101.63,
206.59,
137.28,
74.65,
109.73,
252.86,
73.54,
113.78,
92.15,
72.12,
114.72,
189.61,
99.63,
146.58,
133.55,
60.6,
116.07,
160.08,
151.02,
107.11,
125.38,
64.31,
125.1,
151.1,
108.87,
111.23,
146.07,
166.15,
88.42,
194.58,
89.18,
119.6,
135.18,
113.52,
71.47,
169.39,
173.37,
125.25,
185.85,
110.91,
116.58,
161.18,
125.44,
119.13,
...])
In [ ]:
trajectories_df['tw'].min()
In [ ]:
trajectories_df['tw'].max()
In [ ]:
trajectories_df['tw'].max() - trajectories_df['tw'].min()
In [ ]:
Y = gwv.generate_VectorY_df(trajectories_df)
Y[1200:1450]
In [ ]:
# add missing cars avg
Y2 = Y.reset_index()
routes_mean = Y2.groupby(['intersection_id', 'tollgate_id']).mean()
routes_mean
#pd.concat([Y, [routes_mean]*6546], ignore_index=True)
#2.merge()
In [ ]:
X_df = gwv.generate_timeInformationVectorX_df(trajectories_df)
X_df
In [ ]:
weather_df1 = gwv.prepare_weather_df(weather_df)
weather_df1
In [ ]:
print (weather_df1['date'].max())
print (X_df['datetime'].max())
In [ ]:
# add weather
In [ ]:
weather_df1 = weather_df1.drop(['date','hour'], 1)
tom = X_df.merge(weather_df1.reset_index(), how='left', on='datetime')
tom = tom.drop(['datetime'], 1)
tom
tom1 = tom.as_matrix()
tom1 = tom1.reshape(len(tom)*len(tom.columns))
#tom1
In [16]:
df = trajectories_df
df
Out[16]:
intersection_id
tollgate_id
vehicle_id
starting_time
travel_seq
travel_time
tw
0
B
3
1065642
2016-07-19 00:14:24
105#2016-07-19 00:14:24#9.56;100#2016-07-19 00...
70.85
2016-07-19 00:00:00
1
B
3
1047198
2016-07-19 00:35:56
105#2016-07-19 00:35:56#11.58;100#2016-07-19 0...
148.79
2016-07-19 00:20:00
2
B
1
1086390
2016-07-19 00:37:15
105#2016-07-19 00:37:15#5.26;100#2016-07-19 00...
79.76
2016-07-19 00:20:00
3
A
2
1071181
2016-07-19 00:37:59
110#2016-07-19 00:37:59#13.74;123#2016-07-19 0...
58.05
2016-07-19 00:20:00
4
B
1
1065807
2016-07-19 00:56:21
105#2016-07-19 00:56:21#16.08;100#2016-07-19 0...
137.98
2016-07-19 00:40:00
5
C
3
1072812
2016-07-19 00:56:31
115#2016-07-19 00:56:31#10.97;102#2016-07-19 0...
113.54
2016-07-19 00:40:00
6
B
1
1014648
2016-07-19 01:26:03
105#2016-07-19 01:26:03#16.85;100#2016-07-19 0...
176.70
2016-07-19 01:20:00
7
A
2
1063919
2016-07-19 01:36:04
110#2016-07-19 01:36:04#10.39;123#2016-07-19 0...
74.47
2016-07-19 01:20:00
8
A
3
1064408
2016-07-19 01:36:20
110#2016-07-19 01:36:20#8.58;123#2016-07-19 01...
94.57
2016-07-19 01:20:00
9
C
1
1056529
2016-07-19 01:36:28
115#2016-07-19 01:36:28#9.50;102#2016-07-19 01...
214.87
2016-07-19 01:20:00
10
A
2
1002179
2016-07-19 01:38:48
110#2016-07-19 01:38:48#8.25;123#2016-07-19 01...
39.27
2016-07-19 01:20:00
11
B
3
1056879
2016-07-19 01:40:40
105#2016-07-19 01:40:40#11.40;100#2016-07-19 0...
86.07
2016-07-19 01:40:00
12
A
2
1004088
2016-07-19 01:42:22
110#2016-07-19 01:42:22#8.32;123#2016-07-19 01...
35.38
2016-07-19 01:40:00
13
C
1
1063652
2016-07-19 01:44:57
115#2016-07-19 01:44:57#7.47;102#2016-07-19 01...
189.77
2016-07-19 01:40:00
14
C
1
1057504
2016-07-19 01:46:36
115#2016-07-19 01:46:36#6.77;102#2016-07-19 01...
131.50
2016-07-19 01:40:00
15
A
2
1022331
2016-07-19 01:48:40
110#2016-07-19 01:48:40#9.51;123#2016-07-19 01...
130.43
2016-07-19 01:40:00
16
B
3
1053843
2016-07-19 01:48:47
105#2016-07-19 01:48:47#34.41;100#2016-07-19 0...
101.37
2016-07-19 01:40:00
17
A
2
1004286
2016-07-19 01:52:08
110#2016-07-19 01:52:08#18.05;123#2016-07-19 0...
67.41
2016-07-19 01:40:00
18
B
3
1086111
2016-07-19 02:10:44
105#2016-07-19 02:10:44#5.17;100#2016-07-19 02...
67.81
2016-07-19 02:00:00
19
A
2
1065328
2016-07-19 02:20:16
110#2016-07-19 02:20:16#10.07;123#2016-07-19 0...
42.64
2016-07-19 02:20:00
20
A
3
1054620
2016-07-19 02:36:20
110#2016-07-19 02:36:20#7.42;123#2016-07-19 02...
72.12
2016-07-19 02:20:00
21
A
3
1011942
2016-07-19 02:38:10
110#2016-07-19 02:38:10#8.22;123#2016-07-19 02...
83.10
2016-07-19 02:20:00
22
B
3
1058173
2016-07-19 02:42:15
105#2016-07-19 02:42:15#17.66;100#2016-07-19 0...
142.32
2016-07-19 02:40:00
23
A
2
1027642
2016-07-19 02:42:22
110#2016-07-19 02:42:22#6.65;123#2016-07-19 02...
29.15
2016-07-19 02:40:00
24
A
2
1005189
2016-07-19 02:42:24
110#2016-07-19 02:42:24#7.54;123#2016-07-19 02...
40.12
2016-07-19 02:40:00
25
B
3
1043567
2016-07-19 02:44:00
105#2016-07-19 02:44:00#11.50;100#2016-07-19 0...
192.77
2016-07-19 02:40:00
26
A
2
1056068
2016-07-19 02:58:39
110#2016-07-19 02:58:39#9.42;123#2016-07-19 02...
51.25
2016-07-19 02:40:00
27
A
3
1017831
2016-07-19 03:12:37
110#2016-07-19 03:12:37#7.48;123#2016-07-19 03...
93.09
2016-07-19 03:00:00
28
A
2
1055860
2016-07-19 03:27:36
110#2016-07-19 03:27:36#11.44;123#2016-07-19 0...
44.29
2016-07-19 03:20:00
29
A
2
1085652
2016-07-19 03:36:02
110#2016-07-19 03:36:02#11.39;123#2016-07-19 0...
39.55
2016-07-19 03:20:00
...
...
...
...
...
...
...
...
109214
C
1
1020280
2016-10-17 22:35:53
115#2016-10-17 22:35:53#12.38;102#2016-10-17 2...
117.84
2016-10-17 22:20:00
109215
C
3
1016880
2016-10-17 22:42:49
115#2016-10-17 22:42:49#8.47;102#2016-10-17 22...
189.38
2016-10-17 22:40:00
109216
A
2
1045083
2016-10-17 22:45:00
110#2016-10-17 22:45:00#19.22;123#2016-10-17 2...
67.98
2016-10-17 22:40:00
109217
A
3
1011400
2016-10-17 22:50:11
110#2016-10-17 22:50:11#10.77;123#2016-10-17 2...
83.76
2016-10-17 22:40:00
109218
A
2
1043473
2016-10-17 22:50:23
110#2016-10-17 22:50:23#9.96;123#2016-10-17 22...
53.01
2016-10-17 22:40:00
109219
B
3
1035615
2016-10-17 22:51:12
105#2016-10-17 22:51:12#8.30;100#2016-10-17 22...
60.92
2016-10-17 22:40:00
109220
A
2
1027124
2016-10-17 22:56:18
110#2016-10-17 22:56:18#8.83;123#2016-10-17 22...
46.50
2016-10-17 22:40:00
109221
C
3
1043900
2016-10-17 22:57:13
115#2016-10-17 22:57:13#7.75;102#2016-10-17 22...
111.67
2016-10-17 22:40:00
109222
A
2
1022578
2016-10-17 23:06:06
110#2016-10-17 23:06:06#10.28;123#2016-10-17 2...
45.52
2016-10-17 23:00:00
109223
B
3
1049127
2016-10-17 23:07:24
105#2016-10-17 23:07:24#9.49;100#2016-10-17 23...
60.49
2016-10-17 23:00:00
109224
A
3
1042839
2016-10-17 23:08:13
110#2016-10-17 23:08:13#9.63;123#2016-10-17 23...
104.54
2016-10-17 23:00:00
109225
A
2
1002950
2016-10-17 23:08:18
110#2016-10-17 23:08:18#10.31;123#2016-10-17 2...
48.36
2016-10-17 23:00:00
109226
A
3
1018469
2016-10-17 23:10:45
110#2016-10-17 23:10:45#9.21;123#2016-10-17 23...
102.83
2016-10-17 23:00:00
109227
C
1
1048639
2016-10-17 23:13:29
115#2016-10-17 23:13:29#7.28;102#2016-10-17 23...
194.33
2016-10-17 23:00:00
109228
A
2
1000448
2016-10-17 23:14:16
110#2016-10-17 23:14:16#12.20;123#2016-10-17 2...
48.04
2016-10-17 23:00:00
109229
A
2
1004272
2016-10-17 23:14:17
110#2016-10-17 23:14:17#11.13;123#2016-10-17 2...
61.68
2016-10-17 23:00:00
109230
C
1
1031989
2016-10-17 23:20:17
115#2016-10-17 23:20:17#9.86;102#2016-10-17 23...
159.78
2016-10-17 23:20:00
109231
A
2
1010568
2016-10-17 23:21:50
110#2016-10-17 23:21:50#13.24;123#2016-10-17 2...
40.29
2016-10-17 23:20:00
109232
A
2
1037457
2016-10-17 23:22:08
110#2016-10-17 23:22:08#31.53;123#2016-10-17 2...
123.37
2016-10-17 23:20:00
109233
A
2
1009417
2016-10-17 23:22:19
110#2016-10-17 23:22:19#22.78;123#2016-10-17 2...
124.41
2016-10-17 23:20:00
109234
B
3
1047183
2016-10-17 23:29:43
105#2016-10-17 23:29:43#20.17;100#2016-10-17 2...
131.68
2016-10-17 23:20:00
109235
A
2
1012726
2016-10-17 23:30:10
110#2016-10-17 23:30:10#13.46;123#2016-10-17 2...
55.54
2016-10-17 23:20:00
109236
A
3
1004601
2016-10-17 23:30:43
110#2016-10-17 23:30:43#9.19;123#2016-10-17 23...
222.87
2016-10-17 23:20:00
109237
A
3
1035614
2016-10-17 23:35:56
110#2016-10-17 23:35:56#11.74;123#2016-10-17 2...
91.59
2016-10-17 23:20:00
109238
B
1
1003456
2016-10-17 23:37:31
105#2016-10-17 23:37:31#9.95;100#2016-10-17 23...
97.54
2016-10-17 23:20:00
109239
A
2
1027763
2016-10-17 23:38:52
110#2016-10-17 23:38:52#8.91;123#2016-10-17 23...
52.46
2016-10-17 23:20:00
109240
A
2
1051052
2016-10-17 23:40:19
110#2016-10-17 23:40:19#11.87;123#2016-10-17 2...
42.27
2016-10-17 23:40:00
109241
A
3
1003251
2016-10-17 23:52:18
110#2016-10-17 23:52:18#7.59;123#2016-10-17 23...
71.94
2016-10-17 23:40:00
109242
A
3
1041002
2016-10-17 23:53:57
110#2016-10-17 23:53:57#10.56;123#2016-10-17 2...
132.51
2016-10-17 23:40:00
109243
A
3
1017582
2016-10-17 23:54:35
110#2016-10-17 23:54:35#9.10;123#2016-10-17 23...
137.38
2016-10-17 23:40:00
109244 rows × 7 columns
In [64]:
import datetime
date_start = df['starting_time'].min()
date_end = df['starting_time'].max()
# enddate is next day midnight #normalize=True sets it to midnight
date_end = pd.to_datetime(date_end) + datetime.timedelta(days=1)
print(date_end.day)
print (date_start, date_end)
daterange = pd.date_range(start=date_start, end=date_end, normalize=True, closed='left', freq='20min')
daterange
18
2016-07-19 00:14:24 2016-10-18 23:54:35
Out[64]:
DatetimeIndex(['2016-07-19 00:00:00', '2016-07-19 00:20:00',
'2016-07-19 00:40:00', '2016-07-19 01:00:00',
'2016-07-19 01:20:00', '2016-07-19 01:40:00',
'2016-07-19 02:00:00', '2016-07-19 02:20:00',
'2016-07-19 02:40:00', '2016-07-19 03:00:00',
...
'2016-10-17 20:40:00', '2016-10-17 21:00:00',
'2016-10-17 21:20:00', '2016-10-17 21:40:00',
'2016-10-17 22:00:00', '2016-10-17 22:20:00',
'2016-10-17 22:40:00', '2016-10-17 23:00:00',
'2016-10-17 23:20:00', '2016-10-17 23:40:00'],
dtype='datetime64[ns]', length=6552, freq='20T')
In [46]:
print (df['tw'].max() - df['tw'].min())
90 days 23:40:00
In [17]:
df_seq = df.travel_seq.str.split(';', expand=True)
df = df.join(df_seq)
df
Out[17]:
intersection_id
tollgate_id
vehicle_id
starting_time
travel_seq
travel_time
tw
0
1
2
3
4
5
6
7
8
9
10
11
0
B
3
1065642
2016-07-19 00:14:24
105#2016-07-19 00:14:24#9.56;100#2016-07-19 00...
70.85
2016-07-19 00:00:00
105#2016-07-19 00:14:24#9.56
100#2016-07-19 00:14:34#6.75
111#2016-07-19 00:14:41#13.00
103#2016-07-19 00:14:54#7.47
122#2016-07-19 00:15:02#32.85
None
None
None
None
None
None
None
1
B
3
1047198
2016-07-19 00:35:56
105#2016-07-19 00:35:56#11.58;100#2016-07-19 0...
148.79
2016-07-19 00:20:00
105#2016-07-19 00:35:56#11.58
100#2016-07-19 00:36:08#7.44
111#2016-07-19 00:36:15#16.23
103#2016-07-19 00:36:32#5.95
122#2016-07-19 00:36:40#104.79
None
None
None
None
None
None
None
2
B
1
1086390
2016-07-19 00:37:15
105#2016-07-19 00:37:15#5.26;100#2016-07-19 00...
79.76
2016-07-19 00:20:00
105#2016-07-19 00:37:15#5.26
100#2016-07-19 00:37:20#2.85
111#2016-07-19 00:37:23#5.94
103#2016-07-19 00:37:29#1.13
116#2016-07-19 00:37:30#10.07
101#2016-07-19 00:37:40#5.27
121#2016-07-19 00:37:46#25.51
106#2016-07-19 00:38:11#3.42
113#2016-07-19 00:38:15#19.76
None
None
None
3
A
2
1071181
2016-07-19 00:37:59
110#2016-07-19 00:37:59#13.74;123#2016-07-19 0...
58.05
2016-07-19 00:20:00
110#2016-07-19 00:37:59#13.74
123#2016-07-19 00:38:13#4.70
107#2016-07-19 00:38:17#6.63
108#2016-07-19 00:38:24#4.95
120#2016-07-19 00:38:29#0.74
117#2016-07-19 00:38:30#27.05
None
None
None
None
None
None
4
B
1
1065807
2016-07-19 00:56:21
105#2016-07-19 00:56:21#16.08;100#2016-07-19 0...
137.98
2016-07-19 00:40:00
105#2016-07-19 00:56:21#16.08
100#2016-07-19 00:56:37#12.34
111#2016-07-19 00:56:49#25.75
103#2016-07-19 00:57:15#4.89
116#2016-07-19 00:57:21#38.30
101#2016-07-19 00:57:59#17.87
121#2016-07-19 00:58:17#15.00
106#2016-07-19 00:58:32#0.62
113#2016-07-19 00:58:33#5.98
None
None
None
5
C
3
1072812
2016-07-19 00:56:31
115#2016-07-19 00:56:31#10.97;102#2016-07-19 0...
113.54
2016-07-19 00:40:00
115#2016-07-19 00:56:31#10.97
102#2016-07-19 00:56:42#13.42
109#2016-07-19 00:56:56#8.35
104#2016-07-19 00:57:04#18.12
112#2016-07-19 00:57:22#18.58
111#2016-07-19 00:57:41#12.92
103#2016-07-19 00:57:53#2.30
122#2016-07-19 00:57:58#26.54
None
None
None
None
6
B
1
1014648
2016-07-19 01:26:03
105#2016-07-19 01:26:03#16.85;100#2016-07-19 0...
176.70
2016-07-19 01:20:00
105#2016-07-19 01:26:03#16.85
100#2016-07-19 01:26:20#9.35
111#2016-07-19 01:26:30#19.52
103#2016-07-19 01:26:49#18.43
116#2016-07-19 01:27:12#37.11
101#2016-07-19 01:27:49#14.89
121#2016-07-19 01:28:04#21.81
106#2016-07-19 01:28:26#3.20
113#2016-07-19 01:28:29#30.70
None
None
None
7
A
2
1063919
2016-07-19 01:36:04
110#2016-07-19 01:36:04#10.39;123#2016-07-19 0...
74.47
2016-07-19 01:20:00
110#2016-07-19 01:36:04#10.39
123#2016-07-19 01:36:15#10.09
107#2016-07-19 01:36:25#8.37
108#2016-07-19 01:36:33#14.65
120#2016-07-19 01:36:48#1.30
117#2016-07-19 01:36:49#29.47
None
None
None
None
None
None
8
A
3
1064408
2016-07-19 01:36:20
110#2016-07-19 01:36:20#8.58;123#2016-07-19 01...
94.57
2016-07-19 01:20:00
110#2016-07-19 01:36:20#8.58
123#2016-07-19 01:36:28#5.28
107#2016-07-19 01:36:33#3.32
108#2016-07-19 01:36:37#3.97
119#2016-07-19 01:36:41#0.87
114#2016-07-19 01:36:42#16.29
118#2016-07-19 01:36:58#23.12
122#2016-07-19 01:37:21#33.57
None
None
None
None
9
C
1
1056529
2016-07-19 01:36:28
115#2016-07-19 01:36:28#9.50;102#2016-07-19 01...
214.87
2016-07-19 01:20:00
115#2016-07-19 01:36:28#9.50
102#2016-07-19 01:36:37#11.62
109#2016-07-19 01:36:49#11.98
104#2016-07-19 01:37:01#26.00
112#2016-07-19 01:37:27#17.66
111#2016-07-19 01:37:44#10.74
103#2016-07-19 01:37:55#10.77
116#2016-07-19 01:38:06#16.33
101#2016-07-19 01:38:23#6.78
121#2016-07-19 01:38:30#9.25
106#2016-07-19 01:38:39#1.15
113#2016-07-19 01:38:40#82.87
10
A
2
1002179
2016-07-19 01:38:48
110#2016-07-19 01:38:48#8.25;123#2016-07-19 01...
39.27
2016-07-19 01:20:00
110#2016-07-19 01:38:48#8.25
123#2016-07-19 01:38:56#4.81
107#2016-07-19 01:39:01#2.77
108#2016-07-19 01:39:03#3.26
120#2016-07-19 01:39:07#0.49
117#2016-07-19 01:39:07#20.27
None
None
None
None
None
None
11
B
3
1056879
2016-07-19 01:40:40
105#2016-07-19 01:40:40#11.40;100#2016-07-19 0...
86.07
2016-07-19 01:40:00
105#2016-07-19 01:40:40#11.40
100#2016-07-19 01:40:51#6.28
111#2016-07-19 01:40:57#23.55
103#2016-07-19 01:41:21#6.83
122#2016-07-19 01:41:28#38.07
None
None
None
None
None
None
None
12
A
2
1004088
2016-07-19 01:42:22
110#2016-07-19 01:42:22#8.32;123#2016-07-19 01...
35.38
2016-07-19 01:40:00
110#2016-07-19 01:42:22#8.32
123#2016-07-19 01:42:30#4.50
107#2016-07-19 01:42:35#2.60
108#2016-07-19 01:42:37#3.02
120#2016-07-19 01:42:40#0.49
117#2016-07-19 01:42:41#16.38
None
None
None
None
None
None
13
C
1
1063652
2016-07-19 01:44:57
115#2016-07-19 01:44:57#7.47;102#2016-07-19 01...
189.77
2016-07-19 01:40:00
115#2016-07-19 01:44:57#7.47
102#2016-07-19 01:45:04#12.71
109#2016-07-19 01:45:17#7.53
104#2016-07-19 01:45:24#29.76
112#2016-07-19 01:45:54#45.11
111#2016-07-19 01:46:39#14.64
103#2016-07-19 01:46:54#1.52
116#2016-07-19 01:46:56#16.94
101#2016-07-19 01:47:13#5.89
121#2016-07-19 01:47:19#13.39
106#2016-07-19 01:47:32#1.76
113#2016-07-19 01:47:34#32.77
14
C
1
1057504
2016-07-19 01:46:36
115#2016-07-19 01:46:36#6.77;102#2016-07-19 01...
131.50
2016-07-19 01:40:00
115#2016-07-19 01:46:36#6.77
102#2016-07-19 01:46:43#7.09
109#2016-07-19 01:46:50#6.90
104#2016-07-19 01:46:57#16.57
112#2016-07-19 01:47:13#17.20
111#2016-07-19 01:47:30#12.81
103#2016-07-19 01:47:43#2.00
116#2016-07-19 01:47:45#11.99
101#2016-07-19 01:47:57#5.33
121#2016-07-19 01:48:03#7.92
106#2016-07-19 01:48:11#1.23
113#2016-07-19 01:48:12#35.50
15
A
2
1022331
2016-07-19 01:48:40
110#2016-07-19 01:48:40#9.51;123#2016-07-19 01...
130.43
2016-07-19 01:40:00
110#2016-07-19 01:48:40#9.51
123#2016-07-19 01:48:49#36.31
107#2016-07-19 01:49:26#4.10
108#2016-07-19 01:49:30#4.82
120#2016-07-19 01:49:35#0.72
117#2016-07-19 01:49:35#75.43
None
None
None
None
None
None
16
B
3
1053843
2016-07-19 01:48:47
105#2016-07-19 01:48:47#34.41;100#2016-07-19 0...
101.37
2016-07-19 01:40:00
105#2016-07-19 01:48:47#34.41
100#2016-07-19 01:49:22#9.07
111#2016-07-19 01:49:31#18.92
103#2016-07-19 01:49:49#3.60
122#2016-07-19 01:49:56#32.37
None
None
None
None
None
None
None
17
A
2
1004286
2016-07-19 01:52:08
110#2016-07-19 01:52:08#18.05;123#2016-07-19 0...
67.41
2016-07-19 01:40:00
110#2016-07-19 01:52:08#18.05
123#2016-07-19 01:52:26#7.92
107#2016-07-19 01:52:34#3.72
108#2016-07-19 01:52:38#4.38
120#2016-07-19 01:52:42#0.66
117#2016-07-19 01:52:43#32.41
None
None
None
None
None
None
18
B
3
1086111
2016-07-19 02:10:44
105#2016-07-19 02:10:44#5.17;100#2016-07-19 02...
67.81
2016-07-19 02:00:00
105#2016-07-19 02:10:44#5.17
100#2016-07-19 02:10:50#4.54
111#2016-07-19 02:10:54#12.39
103#2016-07-19 02:11:07#26.15
122#2016-07-19 02:11:33#18.81
None
None
None
None
None
None
None
19
A
2
1065328
2016-07-19 02:20:16
110#2016-07-19 02:20:16#10.07;123#2016-07-19 0...
42.64
2016-07-19 02:20:00
110#2016-07-19 02:20:16#10.07
123#2016-07-19 02:20:26#4.87
107#2016-07-19 02:20:31#2.64
108#2016-07-19 02:20:34#3.64
120#2016-07-19 02:20:37#0.55
117#2016-07-19 02:20:38#20.64
None
None
None
None
None
None
20
A
3
1054620
2016-07-19 02:36:20
110#2016-07-19 02:36:20#7.42;123#2016-07-19 02...
72.12
2016-07-19 02:20:00
110#2016-07-19 02:36:20#7.42
123#2016-07-19 02:36:27#4.01
107#2016-07-19 02:36:31#2.26
108#2016-07-19 02:36:33#2.78
119#2016-07-19 02:36:36#0.62
114#2016-07-19 02:36:37#13.75
118#2016-07-19 02:36:50#16.07
122#2016-07-19 02:37:06#26.12
None
None
None
None
21
A
3
1011942
2016-07-19 02:38:10
110#2016-07-19 02:38:10#8.22;123#2016-07-19 02...
83.10
2016-07-19 02:20:00
110#2016-07-19 02:38:10#8.22
123#2016-07-19 02:38:18#4.80
107#2016-07-19 02:38:23#2.77
108#2016-07-19 02:38:26#3.25
119#2016-07-19 02:38:29#0.73
114#2016-07-19 02:38:30#15.65
118#2016-07-19 02:38:45#19.38
122#2016-07-19 02:39:05#28.10
None
None
None
None
22
B
3
1058173
2016-07-19 02:42:15
105#2016-07-19 02:42:15#17.66;100#2016-07-19 0...
142.32
2016-07-19 02:40:00
105#2016-07-19 02:42:15#17.66
100#2016-07-19 02:42:33#11.11
111#2016-07-19 02:42:44#82.01
103#2016-07-19 02:44:06#2.93
122#2016-07-19 02:44:11#26.32
None
None
None
None
None
None
None
23
A
2
1027642
2016-07-19 02:42:22
110#2016-07-19 02:42:22#6.65;123#2016-07-19 02...
29.15
2016-07-19 02:40:00
110#2016-07-19 02:42:22#6.65
123#2016-07-19 02:42:29#3.86
107#2016-07-19 02:42:33#2.72
108#2016-07-19 02:42:36#3.20
120#2016-07-19 02:42:39#0.48
117#2016-07-19 02:42:39#12.15
None
None
None
None
None
None
24
A
2
1005189
2016-07-19 02:42:24
110#2016-07-19 02:42:24#7.54;123#2016-07-19 02...
40.12
2016-07-19 02:40:00
110#2016-07-19 02:42:24#7.54
123#2016-07-19 02:42:31#5.49
107#2016-07-19 02:42:37#4.27
108#2016-07-19 02:42:41#5.02
120#2016-07-19 02:42:46#0.75
117#2016-07-19 02:42:47#17.12
None
None
None
None
None
None
25
B
3
1043567
2016-07-19 02:44:00
105#2016-07-19 02:44:00#11.50;100#2016-07-19 0...
192.77
2016-07-19 02:40:00
105#2016-07-19 02:44:00#11.50
100#2016-07-19 02:44:11#8.55
111#2016-07-19 02:44:20#151.71
103#2016-07-19 02:46:52#2.07
122#2016-07-19 02:46:55#17.77
None
None
None
None
None
None
None
26
A
2
1056068
2016-07-19 02:58:39
110#2016-07-19 02:58:39#9.42;123#2016-07-19 02...
51.25
2016-07-19 02:40:00
110#2016-07-19 02:58:39#9.42
123#2016-07-19 02:58:49#5.10
107#2016-07-19 02:58:54#2.94
108#2016-07-19 02:58:57#3.46
120#2016-07-19 02:59:00#0.52
117#2016-07-19 02:59:01#29.25
None
None
None
None
None
None
27
A
3
1017831
2016-07-19 03:12:37
110#2016-07-19 03:12:37#7.48;123#2016-07-19 03...
93.09
2016-07-19 03:00:00
110#2016-07-19 03:12:37#7.48
123#2016-07-19 03:12:44#4.05
107#2016-07-19 03:12:48#2.33
108#2016-07-19 03:12:51#2.75
119#2016-07-19 03:12:53#0.62
114#2016-07-19 03:12:54#16.77
118#2016-07-19 03:13:11#20.10
122#2016-07-19 03:13:31#39.09
None
None
None
None
28
A
2
1055860
2016-07-19 03:27:36
110#2016-07-19 03:27:36#11.44;123#2016-07-19 0...
44.29
2016-07-19 03:20:00
110#2016-07-19 03:27:36#11.44
123#2016-07-19 03:27:48#4.92
107#2016-07-19 03:27:53#3.75
108#2016-07-19 03:27:57#6.32
120#2016-07-19 03:28:03#0.88
117#2016-07-19 03:28:04#16.29
None
None
None
None
None
None
29
A
2
1085652
2016-07-19 03:36:02
110#2016-07-19 03:36:02#11.39;123#2016-07-19 0...
39.55
2016-07-19 03:20:00
110#2016-07-19 03:36:02#11.39
123#2016-07-19 03:36:13#4.43
107#2016-07-19 03:36:17#3.95
108#2016-07-19 03:36:21#3.79
120#2016-07-19 03:36:25#0.58
117#2016-07-19 03:36:26#15.55
None
None
None
None
None
None
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
109214
C
1
1020280
2016-10-17 22:35:53
115#2016-10-17 22:35:53#12.38;102#2016-10-17 2...
117.84
2016-10-17 22:20:00
115#2016-10-17 22:35:53#12.38
102#2016-10-17 22:36:05#10.14
109#2016-10-17 22:36:15#9.14
104#2016-10-17 22:36:24#27.65
112#2016-10-17 22:36:52#16.86
111#2016-10-17 22:37:09#7.43
103#2016-10-17 22:37:16#1.41
116#2016-10-17 22:37:18#11.05
101#2016-10-17 22:37:29#5.16
121#2016-10-17 22:37:34#7.24
106#2016-10-17 22:37:42#0.92
113#2016-10-17 22:37:42#8.84
109215
C
3
1016880
2016-10-17 22:42:49
115#2016-10-17 22:42:49#8.47;102#2016-10-17 22...
189.38
2016-10-17 22:40:00
115#2016-10-17 22:42:49#8.47
102#2016-10-17 22:42:57#9.55
109#2016-10-17 22:43:07#9.37
104#2016-10-17 22:43:16#25.66
112#2016-10-17 22:43:42#20.45
111#2016-10-17 22:44:02#50.21
103#2016-10-17 22:44:52#4.56
122#2016-10-17 22:45:00#58.38
None
None
None
None
109216
A
2
1045083
2016-10-17 22:45:00
110#2016-10-17 22:45:00#19.22;123#2016-10-17 2...
67.98
2016-10-17 22:40:00
110#2016-10-17 22:45:00#19.22
123#2016-10-17 22:45:19#10.40
107#2016-10-17 22:45:30#5.99
108#2016-10-17 22:45:36#7.05
120#2016-10-17 22:45:43#1.06
117#2016-10-17 22:45:44#23.98
None
None
None
None
None
None
109217
A
3
1011400
2016-10-17 22:50:11
110#2016-10-17 22:50:11#10.77;123#2016-10-17 2...
83.76
2016-10-17 22:40:00
110#2016-10-17 22:50:11#10.77
123#2016-10-17 22:50:22#4.61
107#2016-10-17 22:50:27#2.66
108#2016-10-17 22:50:29#3.15
119#2016-10-17 22:50:32#0.71
114#2016-10-17 22:50:33#15.00
118#2016-10-17 22:50:48#22.96
122#2016-10-17 22:51:11#23.76
None
None
None
None
109218
A
2
1043473
2016-10-17 22:50:23
110#2016-10-17 22:50:23#9.96;123#2016-10-17 22...
53.01
2016-10-17 22:40:00
110#2016-10-17 22:50:23#9.96
123#2016-10-17 22:50:33#5.09
107#2016-10-17 22:50:38#3.19
108#2016-10-17 22:50:41#5.24
120#2016-10-17 22:50:46#1.16
117#2016-10-17 22:50:48#28.01
None
None
None
None
None
None
109219
B
3
1035615
2016-10-17 22:51:12
105#2016-10-17 22:51:12#8.30;100#2016-10-17 22...
60.92
2016-10-17 22:40:00
105#2016-10-17 22:51:12#8.30
100#2016-10-17 22:51:21#4.38
111#2016-10-17 22:51:25#10.56
103#2016-10-17 22:51:36#3.96
122#2016-10-17 22:51:42#30.92
None
None
None
None
None
None
None
109220
A
2
1027124
2016-10-17 22:56:18
110#2016-10-17 22:56:18#8.83;123#2016-10-17 22...
46.50
2016-10-17 22:40:00
110#2016-10-17 22:56:18#8.83
123#2016-10-17 22:56:26#5.05
107#2016-10-17 22:56:31#3.40
108#2016-10-17 22:56:35#5.22
120#2016-10-17 22:56:40#1.00
117#2016-10-17 22:56:41#23.50
None
None
None
None
None
None
109221
C
3
1043900
2016-10-17 22:57:13
115#2016-10-17 22:57:13#7.75;102#2016-10-17 22...
111.67
2016-10-17 22:40:00
115#2016-10-17 22:57:13#7.75
102#2016-10-17 22:57:21#9.02
109#2016-10-17 22:57:30#8.51
104#2016-10-17 22:57:39#21.68
112#2016-10-17 22:58:00#16.39
111#2016-10-17 22:58:17#11.52
103#2016-10-17 22:58:28#2.58
122#2016-10-17 22:58:32#32.67
None
None
None
None
109222
A
2
1022578
2016-10-17 23:06:06
110#2016-10-17 23:06:06#10.28;123#2016-10-17 2...
45.52
2016-10-17 23:00:00
110#2016-10-17 23:06:06#10.28
123#2016-10-17 23:06:17#4.21
107#2016-10-17 23:06:21#3.00
108#2016-10-17 23:06:24#4.36
120#2016-10-17 23:06:28#0.86
117#2016-10-17 23:06:29#22.52
None
None
None
None
None
None
109223
B
3
1049127
2016-10-17 23:07:24
105#2016-10-17 23:07:24#9.49;100#2016-10-17 23...
60.49
2016-10-17 23:00:00
105#2016-10-17 23:07:24#9.49
100#2016-10-17 23:07:34#6.15
111#2016-10-17 23:07:40#12.96
103#2016-10-17 23:07:53#7.18
122#2016-10-17 23:08:01#23.49
None
None
None
None
None
None
None
109224
A
3
1042839
2016-10-17 23:08:13
110#2016-10-17 23:08:13#9.63;123#2016-10-17 23...
104.54
2016-10-17 23:00:00
110#2016-10-17 23:08:13#9.63
123#2016-10-17 23:08:22#5.21
107#2016-10-17 23:08:27#3.00
108#2016-10-17 23:08:30#3.53
119#2016-10-17 23:08:34#0.80
114#2016-10-17 23:08:35#17.50
118#2016-10-17 23:08:52#21.64
122#2016-10-17 23:09:14#43.54
None
None
None
None
109225
A
2
1002950
2016-10-17 23:08:18
110#2016-10-17 23:08:18#10.31;123#2016-10-17 2...
48.36
2016-10-17 23:00:00
110#2016-10-17 23:08:18#10.31
123#2016-10-17 23:08:29#5.73
107#2016-10-17 23:08:34#3.30
108#2016-10-17 23:08:38#4.78
120#2016-10-17 23:08:43#0.75
117#2016-10-17 23:08:43#23.36
None
None
None
None
None
None
109226
A
3
1018469
2016-10-17 23:10:45
110#2016-10-17 23:10:45#9.21;123#2016-10-17 23...
102.83
2016-10-17 23:00:00
110#2016-10-17 23:10:45#9.21
123#2016-10-17 23:10:54#4.99
107#2016-10-17 23:10:59#2.87
108#2016-10-17 23:11:02#3.38
119#2016-10-17 23:11:06#0.76
114#2016-10-17 23:11:06#17.22
118#2016-10-17 23:11:24#21.96
122#2016-10-17 23:11:46#41.83
None
None
None
None
109227
C
1
1048639
2016-10-17 23:13:29
115#2016-10-17 23:13:29#7.28;102#2016-10-17 23...
194.33
2016-10-17 23:00:00
115#2016-10-17 23:13:29#7.28
102#2016-10-17 23:13:37#9.76
109#2016-10-17 23:13:46#11.28
104#2016-10-17 23:13:58#63.05
112#2016-10-17 23:15:01#43.29
111#2016-10-17 23:15:44#10.36
103#2016-10-17 23:15:54#1.97
116#2016-10-17 23:15:57#15.41
101#2016-10-17 23:16:12#7.19
121#2016-10-17 23:16:19#10.10
106#2016-10-17 23:16:29#1.28
113#2016-10-17 23:16:31#12.33
109228
A
2
1000448
2016-10-17 23:14:16
110#2016-10-17 23:14:16#12.20;123#2016-10-17 2...
48.04
2016-10-17 23:00:00
110#2016-10-17 23:14:16#12.20
123#2016-10-17 23:14:28#6.60
107#2016-10-17 23:14:35#3.81
108#2016-10-17 23:14:39#4.48
120#2016-10-17 23:14:43#0.67
117#2016-10-17 23:14:44#20.04
None
None
None
None
None
None
109229
A
2
1004272
2016-10-17 23:14:17
110#2016-10-17 23:14:17#11.13;123#2016-10-17 2...
61.68
2016-10-17 23:00:00
110#2016-10-17 23:14:17#11.13
123#2016-10-17 23:14:28#5.67
107#2016-10-17 23:14:34#3.43
108#2016-10-17 23:14:37#4.57
120#2016-10-17 23:14:42#0.72
117#2016-10-17 23:14:43#35.68
None
None
None
None
None
None
109230
C
1
1031989
2016-10-17 23:20:17
115#2016-10-17 23:20:17#9.86;102#2016-10-17 23...
159.78
2016-10-17 23:20:00
115#2016-10-17 23:20:17#9.86
102#2016-10-17 23:20:27#10.20
109#2016-10-17 23:20:38#10.56
104#2016-10-17 23:20:48#22.28
112#2016-10-17 23:21:10#17.06
111#2016-10-17 23:21:27#19.38
103#2016-10-17 23:21:47#3.57
116#2016-10-17 23:21:51#16.78
101#2016-10-17 23:22:08#8.65
121#2016-10-17 23:22:17#14.50
106#2016-10-17 23:22:31#1.72
113#2016-10-17 23:22:33#23.78
109231
A
2
1010568
2016-10-17 23:21:50
110#2016-10-17 23:21:50#13.24;123#2016-10-17 2...
40.29
2016-10-17 23:20:00
110#2016-10-17 23:21:50#13.24
123#2016-10-17 23:22:03#3.98
107#2016-10-17 23:22:07#2.46
108#2016-10-17 23:22:09#3.92
120#2016-10-17 23:22:13#0.68
117#2016-10-17 23:22:14#16.29
None
None
None
None
None
None
109232
A
2
1037457
2016-10-17 23:22:08
110#2016-10-17 23:22:08#31.53;123#2016-10-17 2...
123.37
2016-10-17 23:20:00
110#2016-10-17 23:22:08#31.53
123#2016-10-17 23:22:39#13.71
107#2016-10-17 23:22:53#9.14
108#2016-10-17 23:23:02#14.94
120#2016-10-17 23:23:17#1.68
117#2016-10-17 23:23:19#52.37
None
None
None
None
None
None
109233
A
2
1009417
2016-10-17 23:22:19
110#2016-10-17 23:22:19#22.78;123#2016-10-17 2...
124.41
2016-10-17 23:20:00
110#2016-10-17 23:22:19#22.78
123#2016-10-17 23:22:42#11.99
107#2016-10-17 23:22:54#13.95
108#2016-10-17 23:23:08#9.89
120#2016-10-17 23:23:18#2.33
117#2016-10-17 23:23:20#63.41
None
None
None
None
None
None
109234
B
3
1047183
2016-10-17 23:29:43
105#2016-10-17 23:29:43#20.17;100#2016-10-17 2...
131.68
2016-10-17 23:20:00
105#2016-10-17 23:29:43#20.17
100#2016-10-17 23:30:04#15.00
111#2016-10-17 23:30:19#21.82
103#2016-10-17 23:30:40#4.90
122#2016-10-17 23:30:54#60.68
None
None
None
None
None
None
None
109235
A
2
1012726
2016-10-17 23:30:10
110#2016-10-17 23:30:10#13.46;123#2016-10-17 2...
55.54
2016-10-17 23:20:00
110#2016-10-17 23:30:10#13.46
123#2016-10-17 23:30:24#7.29
107#2016-10-17 23:30:31#4.20
108#2016-10-17 23:30:35#6.25
120#2016-10-17 23:30:42#0.99
117#2016-10-17 23:30:43#22.54
None
None
None
None
None
None
109236
A
3
1004601
2016-10-17 23:30:43
110#2016-10-17 23:30:43#9.19;123#2016-10-17 23...
222.87
2016-10-17 23:20:00
110#2016-10-17 23:30:43#9.19
123#2016-10-17 23:30:52#4.78
107#2016-10-17 23:30:57#2.76
108#2016-10-17 23:31:00#3.24
119#2016-10-17 23:31:03#0.73
114#2016-10-17 23:31:04#16.05
118#2016-10-17 23:31:20#74.08
122#2016-10-17 23:32:34#111.87
None
None
None
None
109237
A
3
1035614
2016-10-17 23:35:56
110#2016-10-17 23:35:56#11.74;123#2016-10-17 2...
91.59
2016-10-17 23:20:00
110#2016-10-17 23:35:56#11.74
123#2016-10-17 23:36:08#6.35
107#2016-10-17 23:36:14#3.66
108#2016-10-17 23:36:18#4.31
119#2016-10-17 23:36:22#0.81
114#2016-10-17 23:36:23#14.76
118#2016-10-17 23:36:38#21.83
122#2016-10-17 23:37:00#27.59
None
None
None
None
109238
B
1
1003456
2016-10-17 23:37:31
105#2016-10-17 23:37:31#9.95;100#2016-10-17 23...
97.54
2016-10-17 23:20:00
105#2016-10-17 23:37:31#9.95
100#2016-10-17 23:37:41#7.40
111#2016-10-17 23:37:48#15.44
103#2016-10-17 23:38:04#2.93
116#2016-10-17 23:38:07#21.94
101#2016-10-17 23:38:29#9.06
121#2016-10-17 23:38:38#12.73
106#2016-10-17 23:38:51#1.62
113#2016-10-17 23:38:53#15.54
None
None
None
109239
A
2
1027763
2016-10-17 23:38:52
110#2016-10-17 23:38:52#8.91;123#2016-10-17 23...
52.46
2016-10-17 23:20:00
110#2016-10-17 23:38:52#8.91
123#2016-10-17 23:39:01#4.82
107#2016-10-17 23:39:06#4.01
108#2016-10-17 23:39:10#6.56
120#2016-10-17 23:39:17#0.98
117#2016-10-17 23:39:18#26.46
None
None
None
None
None
None
109240
A
2
1051052
2016-10-17 23:40:19
110#2016-10-17 23:40:19#11.87;123#2016-10-17 2...
42.27
2016-10-17 23:40:00
110#2016-10-17 23:40:19#11.87
123#2016-10-17 23:40:31#5.42
107#2016-10-17 23:40:37#3.92
108#2016-10-17 23:40:41#4.00
120#2016-10-17 23:40:45#0.60
117#2016-10-17 23:40:45#16.27
None
None
None
None
None
None
109241
A
3
1003251
2016-10-17 23:52:18
110#2016-10-17 23:52:18#7.59;123#2016-10-17 23...
71.94
2016-10-17 23:40:00
110#2016-10-17 23:52:18#7.59
123#2016-10-17 23:52:26#4.11
107#2016-10-17 23:52:30#2.37
108#2016-10-17 23:52:32#2.78
119#2016-10-17 23:52:35#0.63
114#2016-10-17 23:52:36#15.16
118#2016-10-17 23:52:51#18.23
122#2016-10-17 23:53:09#20.94
None
None
None
None
109242
A
3
1041002
2016-10-17 23:53:57
110#2016-10-17 23:53:57#10.56;123#2016-10-17 2...
132.51
2016-10-17 23:40:00
110#2016-10-17 23:53:57#10.56
123#2016-10-17 23:54:07#4.02
107#2016-10-17 23:54:11#2.28
108#2016-10-17 23:54:14#4.17
119#2016-10-17 23:54:18#1.44
114#2016-10-17 23:54:19#62.86
118#2016-10-17 23:55:22#22.62
122#2016-10-17 23:55:45#24.51
None
None
None
None
109243
A
3
1017582
2016-10-17 23:54:35
110#2016-10-17 23:54:35#9.10;123#2016-10-17 23...
137.38
2016-10-17 23:40:00
110#2016-10-17 23:54:35#9.10
123#2016-10-17 23:54:44#5.36
107#2016-10-17 23:54:50#3.09
108#2016-10-17 23:54:53#3.64
119#2016-10-17 23:54:56#0.82
114#2016-10-17 23:54:57#18.00
118#2016-10-17 23:55:15#18.73
122#2016-10-17 23:55:34#78.38
None
None
None
None
109244 rows × 19 columns
In [18]:
# iterate... the slow way... :-/
mylist = []
for index, row in df.iterrows():
new_row = [index]
new_row.extend(row[:6])
#print(new_row)
for ele in row[7:]:
#print(ele)
if ele is not None:
row_tmp = ele.split('#')
res_row = list(new_row)
res_row.extend(row_tmp)
#print(res_row)
mylist.append(res_row)
res_columns=['trajectorie','itersection_id','tollgate_id','vehicle_id','starting_time','travel_seq','travel_time']
res_columns.extend(['link','link_starting_time','link_travel_time'])
link_df = pd.DataFrame(mylist, columns=res_columns)
link_df
Out[18]:
trajectorie
itersection_id
tollgate_id
vehicle_id
starting_time
travel_seq
travel_time
link
link_starting_time
link_travel_time
0
0
B
3
1065642
2016-07-19 00:14:24
105#2016-07-19 00:14:24#9.56;100#2016-07-19 00...
70.85
105
2016-07-19 00:14:24
9.56
1
0
B
3
1065642
2016-07-19 00:14:24
105#2016-07-19 00:14:24#9.56;100#2016-07-19 00...
70.85
100
2016-07-19 00:14:34
6.75
2
0
B
3
1065642
2016-07-19 00:14:24
105#2016-07-19 00:14:24#9.56;100#2016-07-19 00...
70.85
111
2016-07-19 00:14:41
13.00
3
0
B
3
1065642
2016-07-19 00:14:24
105#2016-07-19 00:14:24#9.56;100#2016-07-19 00...
70.85
103
2016-07-19 00:14:54
7.47
4
0
B
3
1065642
2016-07-19 00:14:24
105#2016-07-19 00:14:24#9.56;100#2016-07-19 00...
70.85
122
2016-07-19 00:15:02
32.85
5
1
B
3
1047198
2016-07-19 00:35:56
105#2016-07-19 00:35:56#11.58;100#2016-07-19 0...
148.79
105
2016-07-19 00:35:56
11.58
6
1
B
3
1047198
2016-07-19 00:35:56
105#2016-07-19 00:35:56#11.58;100#2016-07-19 0...
148.79
100
2016-07-19 00:36:08
7.44
7
1
B
3
1047198
2016-07-19 00:35:56
105#2016-07-19 00:35:56#11.58;100#2016-07-19 0...
148.79
111
2016-07-19 00:36:15
16.23
8
1
B
3
1047198
2016-07-19 00:35:56
105#2016-07-19 00:35:56#11.58;100#2016-07-19 0...
148.79
103
2016-07-19 00:36:32
5.95
9
1
B
3
1047198
2016-07-19 00:35:56
105#2016-07-19 00:35:56#11.58;100#2016-07-19 0...
148.79
122
2016-07-19 00:36:40
104.79
10
2
B
1
1086390
2016-07-19 00:37:15
105#2016-07-19 00:37:15#5.26;100#2016-07-19 00...
79.76
105
2016-07-19 00:37:15
5.26
11
2
B
1
1086390
2016-07-19 00:37:15
105#2016-07-19 00:37:15#5.26;100#2016-07-19 00...
79.76
100
2016-07-19 00:37:20
2.85
12
2
B
1
1086390
2016-07-19 00:37:15
105#2016-07-19 00:37:15#5.26;100#2016-07-19 00...
79.76
111
2016-07-19 00:37:23
5.94
13
2
B
1
1086390
2016-07-19 00:37:15
105#2016-07-19 00:37:15#5.26;100#2016-07-19 00...
79.76
103
2016-07-19 00:37:29
1.13
14
2
B
1
1086390
2016-07-19 00:37:15
105#2016-07-19 00:37:15#5.26;100#2016-07-19 00...
79.76
116
2016-07-19 00:37:30
10.07
15
2
B
1
1086390
2016-07-19 00:37:15
105#2016-07-19 00:37:15#5.26;100#2016-07-19 00...
79.76
101
2016-07-19 00:37:40
5.27
16
2
B
1
1086390
2016-07-19 00:37:15
105#2016-07-19 00:37:15#5.26;100#2016-07-19 00...
79.76
121
2016-07-19 00:37:46
25.51
17
2
B
1
1086390
2016-07-19 00:37:15
105#2016-07-19 00:37:15#5.26;100#2016-07-19 00...
79.76
106
2016-07-19 00:38:11
3.42
18
2
B
1
1086390
2016-07-19 00:37:15
105#2016-07-19 00:37:15#5.26;100#2016-07-19 00...
79.76
113
2016-07-19 00:38:15
19.76
19
3
A
2
1071181
2016-07-19 00:37:59
110#2016-07-19 00:37:59#13.74;123#2016-07-19 0...
58.05
110
2016-07-19 00:37:59
13.74
20
3
A
2
1071181
2016-07-19 00:37:59
110#2016-07-19 00:37:59#13.74;123#2016-07-19 0...
58.05
123
2016-07-19 00:38:13
4.70
21
3
A
2
1071181
2016-07-19 00:37:59
110#2016-07-19 00:37:59#13.74;123#2016-07-19 0...
58.05
107
2016-07-19 00:38:17
6.63
22
3
A
2
1071181
2016-07-19 00:37:59
110#2016-07-19 00:37:59#13.74;123#2016-07-19 0...
58.05
108
2016-07-19 00:38:24
4.95
23
3
A
2
1071181
2016-07-19 00:37:59
110#2016-07-19 00:37:59#13.74;123#2016-07-19 0...
58.05
120
2016-07-19 00:38:29
0.74
24
3
A
2
1071181
2016-07-19 00:37:59
110#2016-07-19 00:37:59#13.74;123#2016-07-19 0...
58.05
117
2016-07-19 00:38:30
27.05
25
4
B
1
1065807
2016-07-19 00:56:21
105#2016-07-19 00:56:21#16.08;100#2016-07-19 0...
137.98
105
2016-07-19 00:56:21
16.08
26
4
B
1
1065807
2016-07-19 00:56:21
105#2016-07-19 00:56:21#16.08;100#2016-07-19 0...
137.98
100
2016-07-19 00:56:37
12.34
27
4
B
1
1065807
2016-07-19 00:56:21
105#2016-07-19 00:56:21#16.08;100#2016-07-19 0...
137.98
111
2016-07-19 00:56:49
25.75
28
4
B
1
1065807
2016-07-19 00:56:21
105#2016-07-19 00:56:21#16.08;100#2016-07-19 0...
137.98
103
2016-07-19 00:57:15
4.89
29
4
B
1
1065807
2016-07-19 00:56:21
105#2016-07-19 00:56:21#16.08;100#2016-07-19 0...
137.98
116
2016-07-19 00:57:21
38.30
...
...
...
...
...
...
...
...
...
...
...
763538
109240
A
2
1051052
2016-10-17 23:40:19
110#2016-10-17 23:40:19#11.87;123#2016-10-17 2...
42.27
110
2016-10-17 23:40:19
11.87
763539
109240
A
2
1051052
2016-10-17 23:40:19
110#2016-10-17 23:40:19#11.87;123#2016-10-17 2...
42.27
123
2016-10-17 23:40:31
5.42
763540
109240
A
2
1051052
2016-10-17 23:40:19
110#2016-10-17 23:40:19#11.87;123#2016-10-17 2...
42.27
107
2016-10-17 23:40:37
3.92
763541
109240
A
2
1051052
2016-10-17 23:40:19
110#2016-10-17 23:40:19#11.87;123#2016-10-17 2...
42.27
108
2016-10-17 23:40:41
4.00
763542
109240
A
2
1051052
2016-10-17 23:40:19
110#2016-10-17 23:40:19#11.87;123#2016-10-17 2...
42.27
120
2016-10-17 23:40:45
0.60
763543
109240
A
2
1051052
2016-10-17 23:40:19
110#2016-10-17 23:40:19#11.87;123#2016-10-17 2...
42.27
117
2016-10-17 23:40:45
16.27
763544
109241
A
3
1003251
2016-10-17 23:52:18
110#2016-10-17 23:52:18#7.59;123#2016-10-17 23...
71.94
110
2016-10-17 23:52:18
7.59
763545
109241
A
3
1003251
2016-10-17 23:52:18
110#2016-10-17 23:52:18#7.59;123#2016-10-17 23...
71.94
123
2016-10-17 23:52:26
4.11
763546
109241
A
3
1003251
2016-10-17 23:52:18
110#2016-10-17 23:52:18#7.59;123#2016-10-17 23...
71.94
107
2016-10-17 23:52:30
2.37
763547
109241
A
3
1003251
2016-10-17 23:52:18
110#2016-10-17 23:52:18#7.59;123#2016-10-17 23...
71.94
108
2016-10-17 23:52:32
2.78
763548
109241
A
3
1003251
2016-10-17 23:52:18
110#2016-10-17 23:52:18#7.59;123#2016-10-17 23...
71.94
119
2016-10-17 23:52:35
0.63
763549
109241
A
3
1003251
2016-10-17 23:52:18
110#2016-10-17 23:52:18#7.59;123#2016-10-17 23...
71.94
114
2016-10-17 23:52:36
15.16
763550
109241
A
3
1003251
2016-10-17 23:52:18
110#2016-10-17 23:52:18#7.59;123#2016-10-17 23...
71.94
118
2016-10-17 23:52:51
18.23
763551
109241
A
3
1003251
2016-10-17 23:52:18
110#2016-10-17 23:52:18#7.59;123#2016-10-17 23...
71.94
122
2016-10-17 23:53:09
20.94
763552
109242
A
3
1041002
2016-10-17 23:53:57
110#2016-10-17 23:53:57#10.56;123#2016-10-17 2...
132.51
110
2016-10-17 23:53:57
10.56
763553
109242
A
3
1041002
2016-10-17 23:53:57
110#2016-10-17 23:53:57#10.56;123#2016-10-17 2...
132.51
123
2016-10-17 23:54:07
4.02
763554
109242
A
3
1041002
2016-10-17 23:53:57
110#2016-10-17 23:53:57#10.56;123#2016-10-17 2...
132.51
107
2016-10-17 23:54:11
2.28
763555
109242
A
3
1041002
2016-10-17 23:53:57
110#2016-10-17 23:53:57#10.56;123#2016-10-17 2...
132.51
108
2016-10-17 23:54:14
4.17
763556
109242
A
3
1041002
2016-10-17 23:53:57
110#2016-10-17 23:53:57#10.56;123#2016-10-17 2...
132.51
119
2016-10-17 23:54:18
1.44
763557
109242
A
3
1041002
2016-10-17 23:53:57
110#2016-10-17 23:53:57#10.56;123#2016-10-17 2...
132.51
114
2016-10-17 23:54:19
62.86
763558
109242
A
3
1041002
2016-10-17 23:53:57
110#2016-10-17 23:53:57#10.56;123#2016-10-17 2...
132.51
118
2016-10-17 23:55:22
22.62
763559
109242
A
3
1041002
2016-10-17 23:53:57
110#2016-10-17 23:53:57#10.56;123#2016-10-17 2...
132.51
122
2016-10-17 23:55:45
24.51
763560
109243
A
3
1017582
2016-10-17 23:54:35
110#2016-10-17 23:54:35#9.10;123#2016-10-17 23...
137.38
110
2016-10-17 23:54:35
9.10
763561
109243
A
3
1017582
2016-10-17 23:54:35
110#2016-10-17 23:54:35#9.10;123#2016-10-17 23...
137.38
123
2016-10-17 23:54:44
5.36
763562
109243
A
3
1017582
2016-10-17 23:54:35
110#2016-10-17 23:54:35#9.10;123#2016-10-17 23...
137.38
107
2016-10-17 23:54:50
3.09
763563
109243
A
3
1017582
2016-10-17 23:54:35
110#2016-10-17 23:54:35#9.10;123#2016-10-17 23...
137.38
108
2016-10-17 23:54:53
3.64
763564
109243
A
3
1017582
2016-10-17 23:54:35
110#2016-10-17 23:54:35#9.10;123#2016-10-17 23...
137.38
119
2016-10-17 23:54:56
0.82
763565
109243
A
3
1017582
2016-10-17 23:54:35
110#2016-10-17 23:54:35#9.10;123#2016-10-17 23...
137.38
114
2016-10-17 23:54:57
18.00
763566
109243
A
3
1017582
2016-10-17 23:54:35
110#2016-10-17 23:54:35#9.10;123#2016-10-17 23...
137.38
118
2016-10-17 23:55:15
18.73
763567
109243
A
3
1017582
2016-10-17 23:54:35
110#2016-10-17 23:54:35#9.10;123#2016-10-17 23...
137.38
122
2016-10-17 23:55:34
78.38
763568 rows × 10 columns
In [20]:
#links
link_df['link'].describe()
Out[20]:
count 763568
unique 24
top 110
freq 70852
Name: link, dtype: object
In [ ]:
24
In [9]:
link_df
Out[9]:
trajectorie
itersection_id
tollgate_id
vehicle_id
starting_time
travel_seq
travel_time
link
link_starting_time
link_travel_time
0
0
B
3
1065642
2016-07-19 00:14:24
105#2016-07-19 00:14:24#9.56;100#2016-07-19 00...
70.85
105
2016-07-19 00:14:24
9.56
1
0
B
3
1065642
2016-07-19 00:14:24
105#2016-07-19 00:14:24#9.56;100#2016-07-19 00...
70.85
100
2016-07-19 00:14:34
6.75
2
0
B
3
1065642
2016-07-19 00:14:24
105#2016-07-19 00:14:24#9.56;100#2016-07-19 00...
70.85
111
2016-07-19 00:14:41
13.00
3
0
B
3
1065642
2016-07-19 00:14:24
105#2016-07-19 00:14:24#9.56;100#2016-07-19 00...
70.85
103
2016-07-19 00:14:54
7.47
4
0
B
3
1065642
2016-07-19 00:14:24
105#2016-07-19 00:14:24#9.56;100#2016-07-19 00...
70.85
122
2016-07-19 00:15:02
32.85
5
1
B
3
1047198
2016-07-19 00:35:56
105#2016-07-19 00:35:56#11.58;100#2016-07-19 0...
148.79
105
2016-07-19 00:35:56
11.58
6
1
B
3
1047198
2016-07-19 00:35:56
105#2016-07-19 00:35:56#11.58;100#2016-07-19 0...
148.79
100
2016-07-19 00:36:08
7.44
7
1
B
3
1047198
2016-07-19 00:35:56
105#2016-07-19 00:35:56#11.58;100#2016-07-19 0...
148.79
111
2016-07-19 00:36:15
16.23
8
1
B
3
1047198
2016-07-19 00:35:56
105#2016-07-19 00:35:56#11.58;100#2016-07-19 0...
148.79
103
2016-07-19 00:36:32
5.95
9
1
B
3
1047198
2016-07-19 00:35:56
105#2016-07-19 00:35:56#11.58;100#2016-07-19 0...
148.79
122
2016-07-19 00:36:40
104.79
10
2
B
1
1086390
2016-07-19 00:37:15
105#2016-07-19 00:37:15#5.26;100#2016-07-19 00...
79.76
105
2016-07-19 00:37:15
5.26
11
2
B
1
1086390
2016-07-19 00:37:15
105#2016-07-19 00:37:15#5.26;100#2016-07-19 00...
79.76
100
2016-07-19 00:37:20
2.85
12
2
B
1
1086390
2016-07-19 00:37:15
105#2016-07-19 00:37:15#5.26;100#2016-07-19 00...
79.76
111
2016-07-19 00:37:23
5.94
13
2
B
1
1086390
2016-07-19 00:37:15
105#2016-07-19 00:37:15#5.26;100#2016-07-19 00...
79.76
103
2016-07-19 00:37:29
1.13
14
2
B
1
1086390
2016-07-19 00:37:15
105#2016-07-19 00:37:15#5.26;100#2016-07-19 00...
79.76
116
2016-07-19 00:37:30
10.07
15
2
B
1
1086390
2016-07-19 00:37:15
105#2016-07-19 00:37:15#5.26;100#2016-07-19 00...
79.76
101
2016-07-19 00:37:40
5.27
16
2
B
1
1086390
2016-07-19 00:37:15
105#2016-07-19 00:37:15#5.26;100#2016-07-19 00...
79.76
121
2016-07-19 00:37:46
25.51
17
2
B
1
1086390
2016-07-19 00:37:15
105#2016-07-19 00:37:15#5.26;100#2016-07-19 00...
79.76
106
2016-07-19 00:38:11
3.42
18
2
B
1
1086390
2016-07-19 00:37:15
105#2016-07-19 00:37:15#5.26;100#2016-07-19 00...
79.76
113
2016-07-19 00:38:15
19.76
19
3
A
2
1071181
2016-07-19 00:37:59
110#2016-07-19 00:37:59#13.74;123#2016-07-19 0...
58.05
110
2016-07-19 00:37:59
13.74
20
3
A
2
1071181
2016-07-19 00:37:59
110#2016-07-19 00:37:59#13.74;123#2016-07-19 0...
58.05
123
2016-07-19 00:38:13
4.70
21
3
A
2
1071181
2016-07-19 00:37:59
110#2016-07-19 00:37:59#13.74;123#2016-07-19 0...
58.05
107
2016-07-19 00:38:17
6.63
22
3
A
2
1071181
2016-07-19 00:37:59
110#2016-07-19 00:37:59#13.74;123#2016-07-19 0...
58.05
108
2016-07-19 00:38:24
4.95
23
3
A
2
1071181
2016-07-19 00:37:59
110#2016-07-19 00:37:59#13.74;123#2016-07-19 0...
58.05
120
2016-07-19 00:38:29
0.74
24
3
A
2
1071181
2016-07-19 00:37:59
110#2016-07-19 00:37:59#13.74;123#2016-07-19 0...
58.05
117
2016-07-19 00:38:30
27.05
25
4
B
1
1065807
2016-07-19 00:56:21
105#2016-07-19 00:56:21#16.08;100#2016-07-19 0...
137.98
105
2016-07-19 00:56:21
16.08
26
4
B
1
1065807
2016-07-19 00:56:21
105#2016-07-19 00:56:21#16.08;100#2016-07-19 0...
137.98
100
2016-07-19 00:56:37
12.34
27
4
B
1
1065807
2016-07-19 00:56:21
105#2016-07-19 00:56:21#16.08;100#2016-07-19 0...
137.98
111
2016-07-19 00:56:49
25.75
28
4
B
1
1065807
2016-07-19 00:56:21
105#2016-07-19 00:56:21#16.08;100#2016-07-19 0...
137.98
103
2016-07-19 00:57:15
4.89
29
4
B
1
1065807
2016-07-19 00:56:21
105#2016-07-19 00:56:21#16.08;100#2016-07-19 0...
137.98
116
2016-07-19 00:57:21
38.30
...
...
...
...
...
...
...
...
...
...
...
836029
119375
A
3
1027137
2016-10-24 23:42:15
110#2016-10-24 23:42:15#8.08;123#2016-10-24 23...
102.61
107
2016-10-24 23:42:28
2.45
836030
119375
A
3
1027137
2016-10-24 23:42:15
110#2016-10-24 23:42:15#8.08;123#2016-10-24 23...
102.61
108
2016-10-24 23:42:30
2.88
836031
119375
A
3
1027137
2016-10-24 23:42:15
110#2016-10-24 23:42:15#8.08;123#2016-10-24 23...
102.61
119
2016-10-24 23:42:33
0.65
836032
119375
A
3
1027137
2016-10-24 23:42:15
110#2016-10-24 23:42:15#8.08;123#2016-10-24 23...
102.61
114
2016-10-24 23:42:33
16.27
836033
119375
A
3
1027137
2016-10-24 23:42:15
110#2016-10-24 23:42:15#8.08;123#2016-10-24 23...
102.61
118
2016-10-24 23:42:50
28.03
836034
119375
A
3
1027137
2016-10-24 23:42:15
110#2016-10-24 23:42:15#8.08;123#2016-10-24 23...
102.61
122
2016-10-24 23:43:18
39.61
836035
119376
B
3
1018560
2016-10-24 23:42:44
105#2016-10-24 23:42:44#7.19;100#2016-10-24 23...
94.89
105
2016-10-24 23:42:44
7.19
836036
119376
B
3
1018560
2016-10-24 23:42:44
105#2016-10-24 23:42:44#7.19;100#2016-10-24 23...
94.89
100
2016-10-24 23:42:52
4.81
836037
119376
B
3
1018560
2016-10-24 23:42:44
105#2016-10-24 23:42:44#7.19;100#2016-10-24 23...
94.89
111
2016-10-24 23:42:56
42.36
836038
119376
B
3
1018560
2016-10-24 23:42:44
105#2016-10-24 23:42:44#7.19;100#2016-10-24 23...
94.89
103
2016-10-24 23:43:39
2.46
836039
119376
B
3
1018560
2016-10-24 23:42:44
105#2016-10-24 23:42:44#7.19;100#2016-10-24 23...
94.89
122
2016-10-24 23:43:43
35.89
836040
119377
A
3
1049703
2016-10-24 23:44:09
110#2016-10-24 23:44:09#13.03;123#2016-10-24 2...
112.09
110
2016-10-24 23:44:09
13.03
836041
119377
A
3
1049703
2016-10-24 23:44:09
110#2016-10-24 23:44:09#13.03;123#2016-10-24 2...
112.09
123
2016-10-24 23:44:22
4.56
836042
119377
A
3
1049703
2016-10-24 23:44:09
110#2016-10-24 23:44:09#13.03;123#2016-10-24 2...
112.09
107
2016-10-24 23:44:27
2.93
836043
119377
A
3
1049703
2016-10-24 23:44:09
110#2016-10-24 23:44:09#13.03;123#2016-10-24 2...
112.09
108
2016-10-24 23:44:30
3.90
836044
119377
A
3
1049703
2016-10-24 23:44:09
110#2016-10-24 23:44:09#13.03;123#2016-10-24 2...
112.09
119
2016-10-24 23:44:34
1.00
836045
119377
A
3
1049703
2016-10-24 23:44:09
110#2016-10-24 23:44:09#13.03;123#2016-10-24 2...
112.09
114
2016-10-24 23:44:35
21.91
836046
119377
A
3
1049703
2016-10-24 23:44:09
110#2016-10-24 23:44:09#13.03;123#2016-10-24 2...
112.09
118
2016-10-24 23:44:56
24.37
836047
119377
A
3
1049703
2016-10-24 23:44:09
110#2016-10-24 23:44:09#13.03;123#2016-10-24 2...
112.09
122
2016-10-24 23:45:21
40.09
836048
119378
B
3
1016550
2016-10-24 23:50:31
105#2016-10-24 23:50:31#9.67;100#2016-10-24 23...
105.62
105
2016-10-24 23:50:31
9.67
836049
119378
B
3
1016550
2016-10-24 23:50:31
105#2016-10-24 23:50:31#9.67;100#2016-10-24 23...
105.62
100
2016-10-24 23:50:40
7.19
836050
119378
B
3
1016550
2016-10-24 23:50:31
105#2016-10-24 23:50:31#9.67;100#2016-10-24 23...
105.62
111
2016-10-24 23:50:47
15.01
836051
119378
B
3
1016550
2016-10-24 23:50:31
105#2016-10-24 23:50:31#9.67;100#2016-10-24 23...
105.62
103
2016-10-24 23:51:44
44.22
836052
119378
B
3
1016550
2016-10-24 23:50:31
105#2016-10-24 23:50:31#9.67;100#2016-10-24 23...
105.62
122
2016-10-24 23:51:49
27.62
836053
119379
A
2
1037123
2016-10-24 23:55:45
110#2016-10-24 23:55:45#15.47;123#2016-10-24 2...
54.31
110
2016-10-24 23:55:45
15.47
836054
119379
A
2
1037123
2016-10-24 23:55:45
110#2016-10-24 23:55:45#15.47;123#2016-10-24 2...
54.31
123
2016-10-24 23:56:00
8.38
836055
119379
A
2
1037123
2016-10-24 23:55:45
110#2016-10-24 23:55:45#15.47;123#2016-10-24 2...
54.31
107
2016-10-24 23:56:09
4.83
836056
119379
A
2
1037123
2016-10-24 23:55:45
110#2016-10-24 23:55:45#15.47;123#2016-10-24 2...
54.31
108
2016-10-24 23:56:13
5.68
836057
119379
A
2
1037123
2016-10-24 23:55:45
110#2016-10-24 23:55:45#15.47;123#2016-10-24 2...
54.31
120
2016-10-24 23:56:19
0.85
836058
119379
A
2
1037123
2016-10-24 23:55:45
110#2016-10-24 23:55:45#15.47;123#2016-10-24 2...
54.31
117
2016-10-24 23:56:20
19.31
836059 rows × 10 columns
In [10]:
df = link_df
df['starting_time'] = df['starting_time'].astype('datetime64[ns]')
#Get a 20 min sliding window for the dataframe
df_group = df.groupby([pd.Grouper(key='starting_time', freq='20min')])
df['link_travel_time'] = pd.to_numeric(df['link_travel_time'])
mylist_X = []
#Iterate over a sliding window dataframe
for name, group in df_group:
#Get the averages travel time per link
df_temp = group.groupby(['link'])['link_travel_time'].mean().reset_index(name="avg_travel_time")
np_arr = df_temp['avg_travel_time'].tolist()
#Add the averages per link to the List
print (len(np_arr))
mylist_X.append(np_arr)
#Concatenate the X vector (np array) from the list of numpy arrays
X = np.concatenate(mylist_X)
X
5
16
15
24
21
5
10
11
8
6
11
11
16
24
11
19
15
24
19
24
24
19
24
24
24
19
24
24
19
24
24
24
24
24
24
19
24
24
24
24
24
24
24
24
24
24
19
24
24
24
24
24
24
24
24
24
24
19
16
24
17
14
24
19
21
14
14
18
11
14
14
8
10
6
11
22
14
6
14
16
21
14
11
14
14
16
6
10
17
19
16
19
24
24
24
24
24
24
24
22
24
24
14
24
24
24
24
24
24
24
24
24
24
24
21
24
24
24
24
24
24
24
24
24
24
24
19
24
24
24
24
24
14
24
19
22
24
24
10
10
21
22
14
14
15
6
11
6
6
18
6
18
10
6
8
16
6
6
10
10
21
19
19
24
14
19
19
24
10
20
20
20
20
18
24
24
24
24
24
21
24
24
24
24
24
24
24
24
24
24
24
24
24
17
24
24
19
24
19
24
14
19
19
14
14
24
19
10
24
24
10
19
16
16
17
17
18
16
10
10
18
8
11
10
6
6
6
24
24
14
11
24
19
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
14
21
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
19
24
24
19
19
24
24
19
24
22
19
21
24
19
21
14
5
15
12
5
5
12
8
5
8
8
12
15
8
17
8
12
8
24
24
24
24
14
24
24
24
24
24
24
10
24
19
22
24
19
19
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
19
24
24
24
19
24
19
24
19
14
19
24
24
19
19
14
14
24
19
11
24
19
6
14
10
19
14
6
14
11
14
12
14
12
14
19
11
20
10
24
24
24
24
24
14
24
24
24
24
24
24
24
24
24
24
24
19
24
24
24
24
24
24
24
24
24
24
19
24
19
24
19
24
24
24
24
24
14
24
24
14
24
24
24
11
24
19
14
19
14
19
17
12
16
21
12
11
11
14
16
14
11
8
15
22
19
10
16
24
24
19
11
19
24
24
24
24
24
24
24
24
19
24
19
24
24
24
19
24
24
24
24
24
24
24
19
24
24
24
22
24
24
24
24
24
24
24
24
24
24
24
14
14
19
19
24
14
14
19
17
10
14
6
22
16
6
8
12
24
6
16
11
11
24
8
8
10
11
19
6
16
14
24
14
19
14
21
19
19
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
14
24
24
24
24
24
19
14
19
24
14
14
24
24
14
14
14
19
19
10
14
19
11
10
10
10
10
11
22
10
6
6
10
11
10
10
15
19
10
10
21
19
19
19
24
19
24
24
24
19
24
24
19
24
14
24
19
24
24
24
24
24
24
24
24
24
24
24
19
24
24
24
24
24
24
24
24
14
19
24
19
19
19
14
24
19
24
24
24
24
24
22
19
11
21
19
12
21
12
11
11
19
14
14
11
11
16
19
10
10
14
10
19
10
19
24
24
19
19
24
24
22
22
24
24
19
24
22
24
24
24
24
19
24
24
24
24
24
24
24
21
24
24
24
24
14
24
24
19
24
24
19
14
24
14
14
24
24
24
24
24
14
24
14
14
11
19
19
14
11
12
10
16
24
24
19
16
11
14
14
19
6
19
19
24
19
24
19
14
24
24
24
24
19
19
24
24
14
24
24
24
24
24
24
24
24
24
24
19
19
24
24
24
24
24
24
14
21
24
24
24
19
24
14
19
24
19
14
24
21
24
14
14
19
11
19
21
5
12
19
5
14
24
11
6
14
14
11
11
11
14
10
10
22
19
20
24
24
24
24
19
24
24
24
24
24
24
14
24
24
24
24
24
24
24
24
24
24
24
19
24
19
24
24
19
24
22
24
24
24
24
24
24
24
24
14
14
19
19
19
19
10
17
14
24
14
14
16
14
19
14
6
6
19
11
6
14
11
11
11
19
21
12
19
24
19
14
24
24
24
24
19
24
24
24
24
24
24
24
24
24
24
24
19
24
24
24
24
24
24
24
24
24
24
24
21
24
24
24
24
24
24
24
24
24
19
24
14
19
24
14
24
24
18
10
14
16
14
6
20
20
10
6
10
17
12
24
11
11
21
11
10
17
11
24
24
24
19
19
24
24
24
24
24
24
24
24
24
21
24
24
24
24
24
24
24
24
24
24
24
19
19
24
17
19
24
24
24
24
19
24
24
24
24
19
14
19
14
10
24
24
21
14
11
10
19
14
19
14
10
8
5
8
12
6
16
14
10
6
10
11
15
10
10
19
10
19
10
19
24
24
24
24
24
24
24
24
24
19
24
24
24
24
24
24
21
24
24
19
24
24
24
24
24
24
24
24
24
24
19
24
19
24
24
24
24
19
14
14
19
19
24
14
19
19
24
14
24
19
19
18
16
5
10
14
11
19
6
19
6
6
10
10
10
6
10
14
6
21
10
19
24
24
24
24
24
24
24
24
24
24
24
24
24
24
14
24
24
24
24
24
24
24
24
24
21
24
24
24
24
24
24
24
24
19
19
24
24
24
19
24
14
19
24
19
14
21
19
14
14
19
17
10
17
10
17
10
6
6
6
10
6
11
6
9
10
14
14
19
24
14
24
24
24
24
24
24
24
24
24
19
19
24
24
24
21
24
21
19
24
24
24
24
24
24
24
24
24
24
24
24
19
24
14
24
24
24
24
24
14
24
14
14
24
21
11
10
10
18
10
11
9
6
10
11
6
20
14
6
10
11
16
6
10
6
6
10
6
10
24
24
22
24
24
14
24
24
24
24
24
24
14
24
24
24
24
24
24
24
19
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
19
24
24
19
24
14
14
14
14
22
22
14
19
19
16
19
19
19
6
11
14
24
17
19
8
19
12
6
14
6
10
10
6
24
19
11
11
24
14
24
24
24
24
24
24
24
24
24
6
5
11
24
24
24
24
24
24
24
19
24
24
24
24
24
24
24
24
24
24
22
24
24
24
24
19
17
21
16
19
24
19
21
19
11
24
12
6
10
10
10
10
11
18
10
6
8
14
6
6
14
22
19
19
14
14
19
24
24
24
24
24
24
24
24
24
14
21
16
19
24
24
24
24
24
24
24
24
24
24
21
14
10
22
6
22
21
19
24
24
14
24
19
24
19
14
24
24
24
24
14
19
24
10
14
6
14
19
16
6
9
5
16
6
10
6
6
6
6
6
15
19
10
14
14
22
14
24
24
24
24
24
24
24
24
19
24
24
24
24
24
24
24
24
24
24
19
24
24
24
24
24
24
24
24
19
24
22
24
19
14
19
24
14
24
10
14
21
5
6
14
10
12
20
11
6
11
11
8
6
11
5
14
11
20
6
6
15
8
11
24
20
19
22
24
19
24
24
24
22
24
24
24
24
24
24
24
24
21
24
19
24
24
24
24
24
24
24
14
24
24
24
24
24
24
24
24
24
24
24
24
14
14
10
14
16
19
22
21
14
19
14
10
6
22
11
8
22
10
8
8
6
14
6
19
11
10
10
11
14
6
22
14
24
24
24
24
6
24
10
24
19
14
24
18
24
24
24
24
21
19
24
24
24
21
24
24
14
19
24
24
19
24
24
19
14
14
19
19
19
24
19
14
11
14
24
11
10
14
14
19
19
14
14
14
11
11
6
6
6
11
10
11
6
6
10
19
6
10
16
14
19
24
24
24
14
24
19
24
14
24
24
24
24
24
19
14
24
24
24
24
24
24
22
24
24
24
14
24
24
24
24
24
24
24
24
19
24
19
24
19
22
14
14
14
10
22
24
10
16
14
6
14
16
14
14
10
6
19
10
6
10
6
6
24
6
11
19
14
19
24
19
22
19
14
24
24
24
19
24
19
19
24
19
24
24
19
19
24
24
24
24
24
19
24
19
19
19
24
24
24
19
14
24
14
19
24
19
14
19
19
6
22
16
14
14
22
6
17
14
6
14
9
10
14
6
6
10
24
6
6
6
10
6
24
10
9
14
14
14
19
24
19
19
24
24
24
6
6
6
6
5
21
14
19
14
19
24
19
24
24
24
19
19
14
22
16
24
14
10
19
14
14
14
24
24
19
19
24
22
14
19
14
10
16
10
14
5
11
14
6
6
14
8
6
8
12
6
6
8
11
6
22
11
19
24
24
24
24
24
19
14
24
19
10
12
8
24
24
24
24
19
24
19
24
24
16
10
10
6
10
8
15
21
10
24
24
19
19
22
14
19
14
19
18
14
10
22
17
14
10
11
14
14
11
17
8
8
6
5
8
16
5
6
19
19
10
21
24
19
24
19
24
19
14
24
14
24
24
24
24
19
19
19
24
24
24
24
14
24
24
19
10
24
11
24
19
17
24
24
24
18
16
14
24
19
19
11
14
15
19
17
17
14
24
24
19
16
20
14
8
14
6
6
10
6
6
9
6
20
6
11
5
6
10
10
19
20
16
6
19
21
24
19
24
24
21
14
14
14
24
19
24
24
24
19
19
24
24
19
19
24
19
24
17
24
19
19
24
14
24
19
24
17
24
19
24
19
19
11
8
17
14
10
16
14
19
24
19
10
8
10
14
6
10
6
16
10
5
8
10
14
10
6
9
18
19
16
19
12
24
24
19
19
24
19
14
24
19
14
24
19
24
24
19
11
24
24
24
24
24
19
22
17
22
14
19
19
21
22
19
24
24
14
19
14
24
14
19
14
19
24
14
19
14
19
24
15
8
10
10
8
6
8
10
9
10
6
6
10
8
15
6
14
11
6
19
14
19
19
14
19
14
19
19
24
19
24
24
24
19
24
14
19
19
19
24
14
24
24
24
24
19
24
24
19
24
24
19
24
14
19
14
19
14
24
16
19
14
11
17
10
14
14
10
17
8
14
14
19
6
10
6
22
14
8
6
6
11
5
6
11
14
11
14
6
19
24
24
19
19
24
14
19
24
19
14
24
19
24
24
19
19
14
19
19
19
10
24
19
24
19
19
24
22
24
14
24
24
19
24
19
19
24
19
14
14
24
14
24
14
19
24
14
19
10
11
15
6
14
10
22
20
5
10
6
11
12
6
8
10
6
19
14
10
6
10
16
11
14
24
19
19
19
24
24
24
19
19
24
24
24
24
19
24
24
22
19
21
14
24
24
24
24
19
24
24
19
19
24
14
6
14
17
24
19
19
16
19
24
10
14
14
10
14
19
17
6
14
6
10
11
14
11
22
6
6
14
6
6
10
11
6
8
14
10
10
24
14
19
19
19
17
24
14
24
10
24
24
17
19
19
19
24
19
19
14
24
21
19
19
19
24
19
24
24
19
19
24
19
24
19
19
19
24
14
19
10
14
16
14
19
6
14
10
14
10
19
14
10
8
6
16
10
10
11
18
8
10
9
10
6
6
14
11
24
24
19
14
14
19
14
24
24
24
19
19
24
19
24
24
24
24
24
24
24
19
19
16
19
19
24
19
19
14
14
24
14
14
24
19
14
10
19
19
10
19
8
10
10
12
18
17
22
8
14
6
6
16
11
14
22
6
6
6
12
18
17
15
6
24
14
19
19
19
19
14
14
24
24
19
14
24
24
24
19
14
14
14
24
19
14
24
14
19
24
24
19
24
14
19
19
19
24
24
14
14
19
11
14
24
22
14
14
22
14
12
24
10
10
10
11
8
10
8
9
6
8
6
11
10
8
6
10
11
10
6
6
14
19
13
24
10
19
24
14
24
24
19
19
14
22
14
24
19
19
24
8
24
24
24
24
14
14
14
19
19
19
19
16
24
19
24
24
19
16
14
19
14
14
14
19
19
10
10
19
10
24
14
19
19
10
14
8
10
8
8
19
8
12
17
6
10
11
16
10
14
14
19
19
24
10
19
19
24
19
24
23
24
19
19
14
19
24
21
22
24
24
19
19
24
19
19
14
24
22
19
14
19
19
14
19
22
14
10
14
19
19
24
19
11
6
10
19
19
10
6
10
19
12
6
10
12
21
15
18
10
5
10
6
10
15
11
10
6
5
17
11
14
22
24
19
24
24
14
21
14
14
10
21
14
19
19
14
11
14
19
19
24
24
21
14
24
19
19
19
24
19
24
19
14
14
14
24
24
14
10
19
10
6
14
6
14
16
24
14
14
10
17
6
6
6
8
6
6
6
10
14
8
6
6
10
6
10
6
6
20
10
10
19
19
14
22
16
24
19
24
24
19
14
19
24
11
14
19
10
24
19
24
14
24
24
24
19
24
24
24
19
19
14
14
19
14
10
19
19
14
24
14
14
24
19
19
19
10
6
15
19
6
6
10
8
6
6
6
6
6
5
8
5
19
22
19
8
14
24
24
19
24
14
14
14
19
14
14
24
24
14
24
19
14
14
14
16
21
19
21
19
24
14
14
14
24
11
17
21
17
14
10
10
6
10
17
14
11
11
24
15
8
14
5
8
14
14
14
10
6
5
6
6
6
16
5
6
6
6
6
19
16
24
14
24
24
22
11
24
19
19
19
24
11
24
19
21
21
24
24
19
22
19
14
19
14
14
14
14
14
14
14
17
14
14
14
14
10
10
14
19
10
14
19
14
10
14
6
14
22
10
19
10
14
10
6
8
8
6
8
6
5
6
6
5
10
10
19
14
14
21
14
14
22
10
14
24
14
19
11
20
19
14
14
19
24
24
16
24
19
14
24
24
24
19
19
14
24
10
19
14
16
14
19
11
14
24
10
6
6
14
14
5
12
11
6
11
6
8
14
8
22
10
6
11
6
11
8
6
6
14
10
14
19
19
19
14
24
19
24
19
14
22
10
24
14
24
14
19
19
14
19
19
24
14
24
14
22
19
24
14
19
10
10
10
19
19
21
10
14
24
17
14
14
15
24
22
15
6
6
10
8
10
8
24
24
22
6
6
14
20
11
6
6
24
14
24
14
24
24
19
24
24
24
24
24
24
24
24
24
24
24
24
19
24
24
24
24
15
24
24
24
24
24
24
24
16
19
19
24
24
22
24
22
19
11
7
24
24
10
24
24
24
19
19
14
6
10
12
19
8
6
21
17
19
22
12
6
8
8
11
5
9
10
10
14
19
10
10
23
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
22
24
19
24
24
24
24
24
24
24
19
14
24
24
24
24
14
14
24
24
22
21
21
18
22
17
15
19
10
21
6
11
17
9
4
6
24
15
16
12
9
9
17
21
5
11
6
16
10
16
6
24
18
19
19
24
24
24
19
24
24
24
24
24
24
24
24
22
24
19
24
24
24
24
24
19
24
19
24
15
21
22
19
19
24
21
22
21
11
19
24
9
10
10
16
19
10
12
24
6
17
14
18
10
6
11
8
5
20
12
6
10
6
8
8
11
6
6
12
14
16
19
24
10
24
24
24
14
24
24
22
24
22
22
19
24
24
24
22
22
14
19
19
24
22
24
10
10
17
19
6
22
10
11
20
14
18
11
10
10
19
6
6
6
6
6
18
12
10
19
18
5
12
17
6
6
5
5
17
6
18
10
21
19
24
24
24
24
24
24
19
21
15
19
19
24
21
16
21
24
19
24
16
19
16
24
24
21
24
19
19
24
19
24
14
22
19
24
22
21
19
22
18
22
22
10
10
18
19
20
6
18
11
11
12
8
8
6
17
8
6
6
5
24
6
24
24
17
14
22
14
24
24
24
24
21
24
14
24
24
24
17
22
23
14
22
24
21
24
24
11
19
24
24
14
24
24
20
22
24
16
22
19
24
11
22
6
24
24
24
22
15
10
24
14
22
6
6
19
19
14
17
6
10
14
22
12
9
10
20
24
15
5
22
23
20
10
22
19
24
23
24
19
24
24
24
24
24
19
24
24
24
23
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
14
21
24
24
24
22
24
24
19
24
10
21
24
24
24
17
10
15
10
14
19
10
18
22
5
14
10
6
6
6
22
19
10
14
15
14
19
11
21
24
24
24
24
19
24
24
24
19
24
24
24
24
24
24
24
19
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
21
24
24
24
24
24
14
19
24
24
24
24
22
24
19
24
24
11
16
21
12
11
11
8
18
5
8
16
6
6
8
8
5
10
24
15
19
10
24
10
19
24
24
19
24
24
24
24
24
24
24
24
24
24
19
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
19
24
24
14
24
24
24
22
19
24
22
14
19
15
10
11
22
22
19
21
5
8
8
8
8
10
6
5
6
16
19
14
24
24
24
24
19
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
17
24
6
14
24
14
18
6
12
10
8
11
10
6
11
8
6
5
6
16
10
24
19
22
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
19
24
24
24
24
24
24
14
24
16
14
24
21
19
15
24
14
11
11
18
15
12
8
21
14
15
12
22
11
10
19
24
19
24
24
24
24
24
21
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
19
24
24
19
14
19
19
21
19
10
14
22
11
12
19
17
10
8
12
10
6
6
14
11
19
11
15
11
24
11
19
24
19
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
19
19
24
24
24
24
24
24
24
11
24
19
24
19
19
24
10
15
10
20
24
10
6
8
17
5
6
10
6
19
8
10
6
14
10
19
18
10
24
24
19
24
21
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
23
24
24
24
24
24
24
24
24
10
24
24
10
15
24
17
19
17
17
12
15
6
22
18
10
8
10
6
24
19
24
24
24
24
24
22
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
22
24
22
24
24
24
14
24
19
19
24
14
14
6
19
14
20
24
14
19
19
19
14
22
15
6
6
6
8
12
6
6
11
6
8
6
24
15
12
24
24
10
24
24
24
24
24
22
24
24
24
19
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
21
24
16
24
10
10
14
18
8
6
10
5
6
10
5
18
5
6
6
14
10
22
6
22
24
19
24
24
24
24
24
24
24
19
24
24
24
24
24
24
24
24
24
24
24
24
24
19
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
19
24
19
24
24
24
24
24
24
24
24
10
19
12
19
10
24
10
10
8
15
6
18
10
6
6
12
10
6
6
19
24
19
24
24
24
14
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
16
24
19
24
24
11
6
16
24
19
10
10
17
23
8
19
14
10
6
6
6
16
6
9
10
14
24
24
22
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
19
24
24
24
24
24
24
19
24
19
24
22
19
14
19
24
24
24
14
24
14
14
24
19
17
24
5
6
10
14
19
12
6
9
6
14
11
21
19
11
12
19
20
22
22
24
24
19
24
24
24
24
24
24
24
24
24
24
19
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
21
14
24
21
24
14
21
11
19
14
8
10
6
6
24
10
10
19
10
6
10
10
19
24
14
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
19
24
24
24
24
21
24
24
24
24
19
22
24
24
22
24
24
18
17
22
11
5
6
11
6
14
8
11
12
21
11
19
19
14
22
19
23
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
19
24
24
24
24
24
19
19
24
24
24
24
24
14
22
18
10
14
10
24
10
8
18
5
10
6
6
10
10
11
15
10
11
24
10
21
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
19
24
19
24
24
24
19
24
24
24
24
24
24
19
24
24
24
24
14
19
22
6
19
22
10
10
14
9
9
21
14
21
11
21
10
10
19
24
24
24
24
19
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
22
22
24
24
24
24
24
24
19
24
24
24
24
24
24
24
22
19
6
16
10
11
6
10
6
17
17
10
10
8
24
21
21
8
22
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
23
24
24
24
24
10
17
12
19
18
20
12
21
6
11
15
17
10
14
14
17
14
14
14
24
14
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
19
24
24
24
24
24
24
24
23
24
24
24
24
19
24
14
24
19
21
19
10
8
19
6
6
21
10
5
6
20
19
14
12
14
6
14
10
19
22
24
22
24
24
14
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
14
24
10
18
22
20
8
10
14
22
19
12
12
10
14
14
6
22
6
10
6
10
14
24
24
24
24
24
24
24
24
24
24
24
24
24
24
19
24
24
24
19
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
23
24
24
24
24
19
24
24
24
24
24
24
11
21
19
14
18
14
5
11
15
20
11
15
6
8
6
24
19
14
15
10
19
21
10
14
14
24
24
24
19
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
19
24
24
19
11
21
24
24
24
24
24
19
19
19
19
24
24
24
14
19
6
22
21
14
6
21
10
6
10
6
10
10
6
11
10
19
24
10
18
21
24
19
24
24
24
19
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
21
24
21
24
21
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
19
17
17
14
10
8
5
20
12
10
14
15
6
8
21
10
24
24
24
21
24
24
24
24
24
24
24
24
24
24
24
24
22
24
24
21
24
24
24
24
24
24
24
24
24
24
24
24
24
24
21
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
19
24
16
19
19
21
17
11
14
6
10
17
6
6
6
18
16
19
19
6
16
24
24
24
24
24
24
24
24
24
24
24
24
24
24
22
24
22
24
24
24
24
24
24
21
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
16
24
24
24
24
24
24
19
24
24
19
22
22
21
22
22
20
15
22
12
14
12
14
22
10
24
19
6
14
14
10
24
24
24
24
24
23
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
19
24
24
24
24
24
22
24
22
24
10
14
9
24
14
13
16
14
10
14
10
6
24
18
24
10
22
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
19
24
19
19
21
14
22
22
22
21
10
14
10
9
15
16
11
19
6
14
24
19
24
19
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
21
24
24
24
24
24
24
24
24
24
24
24
19
14
24
19
19
19
24
14
19
16
14
17
11
8
10
22
15
10
19
6
19
21
22
24
24
24
19
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
19
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
19
24
24
24
24
24
22
24
24
19
14
19
11
19
20
10
19
10
15
14
6
6
10
16
19
14
19
10
24
10
24
24
24
24
19
24
24
24
24
24
24
24
24
24
14
24
19
19
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
19
24
24
24
19
24
14
19
24
24
19
19
24
14
22
21
12
19
6
8
22
6
11
11
6
6
15
6
8
10
10
11
10
24
14
22
19
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
19
17
24
24
24
9
19
19
22
11
24
14
24
18
24
24
14
19
22
6
20
10
5
9
10
9
10
8
21
14
10
19
24
24
24
24
24
24
24
24
24
24
24
24
24
24
19
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
19
24
24
19
24
24
14
24
24
24
21
21
24
14
22
24
10
19
5
6
14
10
6
6
10
20
15
8
15
6
6
14
24
22
24
19
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
19
24
24
24
24
24
24
21
24
24
24
19
24
15
24
14
14
6
19
24
10
8
6
14
6
11
6
10
6
14
10
20
10
19
24
24
24
19
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
19
24
19
24
24
24
24
24
19
24
14
22
24
10
20
24
14
6
22
14
14
6
21
22
10
10
14
15
6
22
19
6
21
14
14
24
19
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
19
24
24
24
22
24
24
24
24
24
24
24
19
19
24
9
24
11
16
14
12
19
20
14
5
10
8
6
18
10
22
17
10
16
19
24
24
19
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
22
24
24
14
21
22
6
19
16
22
10
14
18
10
8
6
10
19
6
24
21
11
24
14
22
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
22
24
24
22
24
22
24
21
24
8
22
24
16
19
10
10
11
11
15
10
11
10
10
6
11
10
24
22
10
24
19
19
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
19
24
21
24
24
24
24
21
24
19
24
17
22
20
19
14
19
19
8
6
10
18
6
6
14
14
22
18
10
10
19
24
19
24
19
24
24
24
19
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
15
22
19
24
24
14
24
19
19
24
24
24
10
10
24
19
24
24
10
24
10
12
6
6
11
14
6
10
10
21
6
10
14
22
10
22
24
24
24
24
21
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
14
10
12
22
19
19
19
21
15
24
6
18
11
11
18
16
6
10
5
10
11
22
10
24
24
14
19
24
24
19
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
20
24
24
24
19
24
19
24
14
24
23
24
24
22
21
22
12
9
22
22
5
14
21
21
17
14
6
16
10
15
10
6
14
18
10
14
10
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
21
14
22
22
24
19
22
19
20
10
19
18
14
10
22
10
14
10
16
16
5
6
14
10
19
17
22
10
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
19
19
24
24
24
10
24
24
18
14
8
19
14
11
10
8
6
10
6
9
15
24
19
12
10
10
14
19
24
24
19
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
19
24
24
24
24
24
24
24
24
24
24
24
24
19
24
21
24
14
24
24
24
14
24
14
16
19
10
19
17
6
14
19
18
14
18
6
6
6
6
6
19
10
24
24
22
19
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
19
24
24
24
24
14
24
24
24
19
24
19
19
8
14
6
9
8
6
13
20
15
15
12
10
10
6
24
24
24
24
19
24
24
24
24
24
24
24
19
24
24
24
24
24
24
24
24
24
24
24
24
24
24
24
19
24
24
24
24
24
24
24
24
24
24
24
24
19
24
24
19
24
24
14
24
22
19
19
24
24
6
19
19
Out[10]:
array([ 6.75 , 7.47 , 9.56 , ..., 14.67 , 35.576 , 6.5075])
In [11]:
len(df['link'].unique())
Out[11]:
24
In [12]:
df2 = df.groupby([pd.Grouper(key='starting_time', freq='20min'), 'link'])['link_travel_time'].mean()
df2.tolist()
Out[12]:
[6.75,
7.4699999999999998,
9.5600000000000005,
13.0,
32.850000000000001,
5.1450000000000005,
5.2699999999999996,
3.54,
8.4199999999999999,
3.4199999999999999,
6.6299999999999999,
4.9500000000000002,
13.74,
11.085000000000001,
19.760000000000002,
10.07,
27.050000000000001,
0.73999999999999999,
25.510000000000002,
104.79000000000001,
4.7000000000000002,
12.34,
17.870000000000001,
13.42,
3.5949999999999998,
18.120000000000001,
16.079999999999998,
0.62,
8.3499999999999996,
19.335000000000001,
18.579999999999998,
5.9800000000000004,
10.970000000000001,
38.299999999999997,
15.0,
26.539999999999999,
9.3499999999999996,
10.835000000000001,
11.619999999999999,
14.6,
26.0,
16.850000000000001,
2.1749999999999998,
4.8199999999999994,
7.2933333333333339,
11.98,
9.0733333333333324,
15.129999999999999,
17.66,
56.785000000000004,
16.289999999999999,
9.5,
26.719999999999999,
24.869999999999997,
23.120000000000001,
0.87,
0.89500000000000002,
15.529999999999999,
33.57,
6.7266666666666666,
7.6750000000000007,
5.6099999999999994,
9.9000000000000004,
3.4874999999999998,
23.164999999999999,
22.904999999999998,
1.4950000000000001,
3.4733333333333332,
4.0733333333333333,
7.2149999999999999,
11.959999999999999,
17.48,
31.155000000000001,
34.135000000000005,
7.1199999999999992,
14.465,
41.406666666666666,
0.62333333333333341,
10.655000000000001,
35.219999999999999,
16.243333333333336,
4.54,
26.149999999999999,
5.1699999999999999,
12.390000000000001,
18.809999999999999,
2.5566666666666666,
3.2233333333333332,
8.5700000000000003,
14.699999999999999,
20.640000000000001,
17.725000000000001,
0.67500000000000004,
0.55000000000000004,
27.109999999999999,
4.5599999999999996,
9.8300000000000001,
2.5,
14.58,
3.3100000000000001,
3.8933333333333331,
7.8700000000000001,
116.86000000000001,
19.506666666666668,
0.58333333333333337,
22.045000000000002,
4.8166666666666664,
2.3300000000000001,
2.75,
7.4800000000000004,
16.77,
20.100000000000001,
0.62,
39.090000000000003,
4.0499999999999998,
3.8500000000000001,
5.0549999999999997,
11.414999999999999,
15.92,
0.72999999999999998,
4.6749999999999998,
6.5999999999999996,
13.529999999999999,
14.047499999999999,
3.5133333333333332,
4.8300000000000001,
8.4900000000000002,
26.190000000000005,
17.763333333333332,
0.66666666666666663,
36.490000000000002,
4.3833333333333329,
6.9049999999999994,
4.2699999999999996,
16.155000000000001,
2.9166666666666665,
4.6499999999999995,
8.3200000000000003,
21.140000000000001,
27.129999999999999,
1.1366666666666667,
45.170000000000002,
4.5066666666666668,
5.6349999999999998,
7.04,
4.8499999999999996,
8.5800000000000001,
1.53,
4.1783333333333337,
5.9766666666666666,
16.286666666666665,
11.065,
27.059999999999999,
15.109999999999999,
27.77333333333333,
0.92666666666666664,
12.07,
23.149999999999999,
6.6949999999999994,
4.9299999999999997,
10.300000000000001,
8.2899999999999991,
5.666666666666667,
23.18,
4.8849999999999998,
1.1200000000000001,
3.044,
4.1300000000000008,
11.66,
11.666,
9.3433333333333337,
37.939999999999998,
48.299999999999997,
17.456666666666667,
12.460000000000001,
10.49,
23.115000000000002,
19.883333333333336,
0.82666666666666666,
0.85499999999999998,
8.8499999999999996,
28.263999999999999,
5.2039999999999997,
9.6099999999999994,
125.2,
13.73,
4.0280000000000005,
4.9820000000000011,
10.263999999999999,
34.850000000000001,
23.355999999999998,
0.77400000000000002,
24.66,
5.9779999999999998,
4.0599999999999996,
4.3899999999999997,
1.8999999999999999,
7.9400000000000004,
1.1399999999999999,
3.7374999999999994,
4.80375,
15.50375,
8.5,
20.98,
16.09,
11.02,
21.982857142857142,
73.030000000000001,
0.78000000000000003,
0.76714285714285724,
6.7000000000000002,
56.359999999999999,
6.46,
4.8700000000000001,
4.54,
5.0199999999999996,
4.0899999999999999,
1.3400000000000001,
4.3342857142857145,
4.4342857142857151,
14.22857142857143,
19.75,
27.829999999999998,
12.59,
27.798571428571428,
0.69714285714285718,
6.9500000000000002,
6.7942857142857154,
6.9550000000000001,
8.4600000000000009,
8.6199999999999992,
22.77,
19.280000000000001,
11.745000000000001,
3.105,
3.8542857142857145,
4.5457142857142854,
8.8800000000000008,
12.037142857142857,
14.35,
13.09,
59.234999999999999,
19.185000000000002,
11.94,
22.484999999999999,
17.556000000000001,
60.314999999999998,
0.83999999999999997,
0.752,
11.885,
32.086666666666666,
5.9657142857142853,
8.1099999999999994,
10.109999999999999,
2.8399999999999999,
22.039999999999999,
8.7300000000000004,
4.7069999999999999,
4.4060000000000006,
9.9000000000000004,
10.949000000000002,
23.765000000000001,
18.809999999999999,
16.994,
8.3399999999999999,
18.588000000000001,
20.124000000000002,
0.87800000000000011,
0.77999999999999992,
39.188571428571429,
7.5149999999999988,
6.0099999999999998,
6.0,
11.609999999999999,
2.0699999999999998,
18.68,
7.79,
1.8300000000000001,
3.5176923076923075,
4.5599999999999996,
10.425000000000001,
13.451538461538462,
56.763333333333343,
15.09,
17.559999999999999,
21.048000000000002,
10.515000000000001,
12.85,
41.392499999999998,
72.775999999999996,
1.0919999999999999,
0.72749999999999992,
9.3100000000000005,
49.012857142857136,
6.1607692307692314,
5.6516666666666673,
6.54,
5.8099999999999996,
2.3457142857142861,
12.99,
9.6216666666666679,
1.1699999999999999,
4.544999999999999,
5.9591666666666656,
5.9900000000000002,
11.609999999999999,
54.067142857142855,
8.8200000000000003,
10.41,
17.899999999999999,
4.75,
14.01,
34.481000000000002,
22.810000000000002,
0.96999999999999997,
1.3359999999999999,
9.1799999999999997,
36.606249999999996,
5.6200000000000001,
5.8700000000000001,
7.7000000000000002,
2.0966666666666667,
26.23,
8.2949999999999999,
4.9493333333333336,
5.362000000000001,
9.3200000000000003,
14.192666666666668,
61.636666666666677,
57.270000000000003,
17.071999999999999,
7.2999999999999998,
50.075999999999993,
45.346000000000004,
1.262,
1.1919999999999999,
30.477500000000003,
7.3233333333333333,
5.4800000000000004,
9.4000000000000004,
16.420000000000002,
3.6799999999999997,
36.719999999999999,
9.9600000000000009,
1.6799999999999999,
4.9900000000000002,
19.266923076923078,
16.920000000000002,
13.063076923076922,
35.245000000000005,
24.940000000000001,
16.109999999999999,
36.549999999999997,
8.0600000000000005,
20.129999999999999,
25.635555555555552,
21.522500000000001,
1.2450000000000001,
1.0066666666666668,
13.199999999999999,
22.295999999999999,
8.0561538461538458,
12.933333333333332,
5.7466666666666661,
11.2775,
2.2057142857142855,
28.087499999999999,
17.623333333333335,
1.2000000000000002,
5.7677777777777779,
6.1549999999999985,
12.692500000000001,
14.648333333333332,
34.18,
19.849999999999998,
29.386666666666667,
21.605,
10.280000000000001,
12.256666666666666,
45.888571428571431,
51.164999999999999,
1.7324999999999999,
1.1507142857142856,
8.7400000000000002,
28.313749999999999,
7.1633333333333331,
7.1316666666666668,
10.355,
11.74,
4.2699999999999996,
25.835000000000001,
10.211666666666666,
1.085,
4.9257142857142853,
8.399047619047618,
11.904999999999999,
13.588571428571429,
46.674999999999997,
16.045000000000002,
10.425000000000001,
32.008571428571429,
9.9699999999999989,
22.190000000000001,
43.565000000000005,
54.557142857142857,
1.6142857142857143,
1.2614285714285713,
14.065,
47.263076923076923,
8.0085714285714271,
20.077000000000002,
6.3933333333333335,
4.8340000000000005,
7.9989999999999997,
1.6533333333333333,
4.9886363636363633,
5.7240909090909096,
15.622727272727275,
65.552999999999997,
18.22666666666667,
21.98,
12.799999999999999,
29.140769230769227,
49.248888888888892,
1.2166666666666666,
1.0223076923076924,
9.9900000000000002,
33.978749999999998,
8.1781818181818196,
10.183333333333334,
6.378333333333333,
12.536666666666667,
6.7088888888888887,
29.893333333333331,
13.168333333333335,
3.0716666666666668,
5.8433333333333346,
7.3552380952380956,
13.276666666666666,
16.630476190476191,
54.578888888888891,
42.533333333333331,
24.486666666666665,
36.767499999999998,
8.3599999999999994,
16.02333333333333,
38.051176470588238,
88.34333333333332,
0.90249999999999997,
0.95176470588235274,
39.966666666666669,
28.084285714285716,
8.6342857142857135,
7.7740000000000009,
7.1400000000000006,
9.1500000000000004,
3.0566666666666666,
23.449999999999999,
10.255999999999997,
1.165,
4.6066666666666656,
4.9983333333333322,
9.3599999999999994,
15.624444444444444,
41.155000000000001,
16.050000000000001,
13.424999999999999,
26.396666666666665,
8.6999999999999993,
15.17,
32.371666666666663,
51.368333333333332,
1.0033333333333332,
0.84083333333333343,
33.875,
54.521000000000001,
6.788333333333334,
6.2975000000000003,
7.9900000000000002,
23.363999999999997,
21.030000000000001,
10.9825,
4.5700000000000003,
4.9543749999999998,
7.6799999999999997,
10.576875000000001,
41.829999999999998,
14.09,
16.045000000000002,
8.3300000000000001,
42.157142857142844,
53.825000000000003,
0.80499999999999994,
0.80000000000000016,
32.937142857142859,
5.6312500000000005,
9.8955555555555552,
15.678333333333333,
10.157499999999999,
5.2830769230769237,
25.227500000000003,
13.435555555555558,
2.0600000000000001,
5.5147058823529402,
5.3241176470588245,
10.057500000000001,
12.783529411764706,
32.363076923076918,
18.59,
38.130000000000003,
15.285,
9.0800000000000018,
18.688333333333336,
47.157692307692301,
30.807499999999997,
0.92000000000000004,
0.98923076923076947,
14.641666666666666,
24.489090909090908,
6.8635294117647057,
8.4012499999999992,
6.9257142857142862,
10.379999999999999,
4.9121428571428556,
24.996666666666666,
11.408750000000001,
1.9942857142857144,
4.5578571428571424,
5.0200000000000005,
10.346666666666666,
12.303571428571432,
50.706428571428582,
20.09333333333333,
27.795714285714286,
29.77333333333333,
12.176666666666668,
19.45428571428571,
31.048181818181821,
32.289999999999999,
1.49,
0.83090909090909082,
16.927142857142858,
32.113999999999997,
6.4335714285714287,
5.71,
4.8399999999999999,
18.280000000000001,
2.1033333333333331,
40.890000000000001,
8.0700000000000003,
0.94500000000000006,
4.5324999999999998,
6.7231249999999996,
18.84,
12.41625,
27.166666666666668,
27.77,
13.425000000000001,
23.009999999999998,
14.93,
79.974999999999994,
41.600000000000009,
41.995714285714293,
1.2042857142857142,
0.83444444444444454,
7.4699999999999998,
28.233750000000004,
6.5606249999999999,
4.2050000000000001,
3.9099999999999997,
3.5899999999999999,
2.3940000000000001,
8.0399999999999991,
6.7524999999999995,
0.69999999999999996,
4.5630769230769239,
5.2061538461538452,
3.7000000000000002,
11.731538461538463,
33.847999999999999,
5.46,
6.7050000000000001,
16.93,
2.9399999999999999,
8.3800000000000008,
40.559999999999995,
26.212,
0.90200000000000014,
0.84124999999999994,
5.4950000000000001,
33.484999999999999,
6.4969230769230766,
6.4375,
6.8300000000000001,
12.42,
2.6640000000000001,
42.149999999999999,
11.4375,
1.22,
3.8628571428571425,
4.0914285714285707,
12.789999999999999,
10.861428571428572,
23.937999999999999,
38.359999999999999,
34.159999999999997,
13.82,
10.140000000000001,
14.640000000000001,
17.692500000000003,
18.353333333333335,
0.72333333333333327,
0.63,
9.5999999999999996,
32.24285714285714,
5.9228571428571444,
5.0033333333333339,
80.560000000000002,
10.119999999999999,
2.5724999999999998,
22.5,
15.576666666666666,
0.56999999999999995,
3.9289999999999994,
3.3609999999999998,
10.31,
8.7839999999999989,
36.052499999999995,
15.279999999999999,
5.46,
14.539999999999999,
8.2599999999999998,
13.83,
27.975714285714286,
26.620000000000001,
0.73666666666666669,
0.49857142857142861,
4.4800000000000004,
23.776666666666667,
4.5239999999999991,
11.504999999999999,
7.96,
4.0,
15.27,
21.32,
5.0684615384615386,
4.3538461538461535,
10.977692307692308,
43.439999999999998,
36.289999999999999,
15.65,
15.65,
31.622727272727275,
21.359999999999999,
0.70499999999999996,
0.83000000000000007,
11.5,
48.446666666666665,
6.3730769230769226,
8.6600000000000001,
7.2324999999999999,
12.34,
13.762,
26.674999999999997,
9.9266666666666676,
1.2675000000000001,
3.2662499999999999,
5.4256250000000001,
12.5,
12.313124999999999,
15.353999999999999,
23.379999999999999,
17.822499999999998,
14.662499999999998,
12.465,
14.465,
19.527499999999996,
30.177499999999998,
0.80500000000000005,
2.9541666666666671,
29.927499999999998,
23.615999999999996,
5.1400000000000006,
8.1325000000000003,
4.4550000000000001,
10.699999999999999,
5.0683333333333334,
23.710000000000001,
11.637500000000001,
0.98499999999999999,
3.7860000000000005,
4.5199999999999996,
9.8300000000000001,
9.6704999999999988,
49.31333333333334,
18.035,
25.390000000000001,
25.375714285714285,
9.3500000000000014,
10.129999999999999,
26.712307692307693,
18.80714285714286,
0.96285714285714286,
0.84769230769230774,
6.6150000000000002,
31.661818181818184,
5.7109999999999994,
6.671666666666666,
6.0700000000000003,
8.8399999999999999,
6.1185714285714283,
21.48,
19.101666666666667,
1.1799999999999999,
3.3211111111111111,
4.3361111111111121,
9.4600000000000009,
9.6238888888888887,
35.21857142857143,
16.140000000000001,
16.32,
16.277999999999999,
9.0600000000000005,
12.119999999999999,
33.521538461538462,
22.318000000000001,
0.81200000000000006,
0.77307692307692311,
8.9900000000000002,
39.751818181818187,
5.5916666666666659,
8.5749999999999993,
8.6724999999999994,
14.813333333333333,
3.5209090909090914,
33.726666666666667,
11.62875,
1.6274999999999999,
4.0493750000000004,
4.9350000000000005,
9.5333333333333332,
11.765625000000002,
38.378181818181822,
27.120000000000001,
27.405000000000001,
15.738571428571428,
17.609999999999999,
18.690000000000001,
25.424444444444443,
20.205714285714286,
0.76000000000000001,
0.96666666666666656,
12.422499999999999,
38.923571428571435,
6.1956250000000006,
7.2074999999999996,
8.1050000000000004,
7.0700000000000003,
3.1699999999999999,
27.949999999999999,
17.9575,
1.4775,
3.9944444444444449,
9.7716666666666665,
8.4000000000000004,
10.981666666666667,
23.524000000000001,
14.779999999999999,
26.717500000000001,
14.235714285714286,
5.2300000000000004,
16.105,
32.762727272727275,
23.421428571428571,
0.75428571428571434,
0.77727272727272734,
11.0875,
29.133749999999999,
6.4694444444444441,
9.7360000000000007,
14.343333333333334,
11.190000000000001,
5.2928571428571427,
25.675000000000001,
13.632,
2.5066666666666668,
4.8131250000000003,
5.6062500000000002,
11.455,
13.508125000000003,
64.262857142857143,
18.355,
20.976666666666667,
17.842000000000002,
11.335000000000001,
38.5,
27.569090909090907,
20.216000000000001,
1.1300000000000001,
0.94090909090909103,
32.353333333333332,
30.354444444444443,
9.490000000000002,
10.92625,
6.4633333333333338,
9.8785714285714299,
4.852666666666666,
26.071428571428573,
15.018750000000001,
1.4400000000000002,
5.7089999999999996,
5.9334999999999996,
10.521428571428572,
12.519500000000001,
53.108666666666672,
33.970000000000006,
43.216666666666669,
18.228749999999998,
8.7957142857142863,
21.596666666666664,
38.123333333333335,
23.893750000000001,
1.1812500000000001,
0.94499999999999995,
21.466666666666665,
33.529500000000006,
6.6099999999999994,
8.365000000000002,
5.0700000000000003,
8.0899999999999999,
3.1676923076923078,
22.879999999999999,
11.909166666666664,
1.0449999999999999,
4.2310526315789474,
5.8636842105263156,
7.4299999999999997,
10.963157894736842,
45.228461538461538,
57.130000000000003,
17.800000000000001,
17.843333333333334,
8.7699999999999996,
10.92,
35.825625000000002,
28.873333333333335,
0.9966666666666667,
1.0337500000000002,
7.6100000000000003,
40.291428571428568,
5.5710526315789481,
8.5899999999999999,
7.1750000000000007,
9.1166666666666671,
4.8250000000000011,
23.203333333333333,
10.652857142857144,
1.1200000000000001,
5.9466666666666663,
5.0946666666666669,
8.4266666666666676,
11.995333333333333,
41.003,
17.873333333333331,
27.530000000000001,
14.823333333333332,
9.1133333333333351,
14.765000000000001,
48.00416666666667,
17.59,
0.80666666666666664,
0.76749999999999996,
8.9149999999999991,
42.583636363636373,
6.2673333333333341,
7.8700000000000001,
7.8725000000000005,
10.337999999999997,
16.229090909090907,
61.423999999999999,
9.7149999999999999,
1.2725,
5.7157142857142844,
6.075000000000002,
10.018000000000001,
12.359285714285715,
45.156363636363636,
29.649999999999999,
27.004999999999995,
16.375,
10.398,
17.064999999999998,
36.814,
21.855,
0.92999999999999994,
0.96999999999999997,
30.754999999999999,
31.041818181818186,
7.0914285714285716,
9.9087499999999995,
6.3300000000000001,
6.5587499999999999,
17.4925,
1.0250000000000001,
5.3706666666666658,
5.0519999999999987,
11.276666666666669,
42.104999999999997,
21.010000000000002,
26.712,
14.109999999999999,
27.941000000000003,
36.713999999999999,
1.5559999999999998,
0.78300000000000003,
8.3499999999999996,
27.195454545454549,
6.4733333333333327,
9.0287499999999987,
5.7125000000000004,
10.411666666666667,
10.018571428571429,
25.301666666666666,
13.6625,
1.2749999999999999,
3.2399999999999998,
4.1699999999999999,
10.266666666666666,
10.134615384615385,
32.664999999999999,
19.578333333333333,
13.1975,
18.602222222222224,
9.2916666666666661,
13.734999999999999,
34.637500000000003,
48.25222222222223,
0.93666666666666665,
0.79499999999999993,
8.0225000000000009,
41.27315789473684,
5.160000000000001,
8.444285714285714,
7.8416666666666659,
9.7287499999999998,
4.2960000000000003,
31.171250000000001,
13.137142857142859,
1.8516666666666666,
4.0558333333333332,
4.8691666666666666,
10.151250000000001,
12.395000000000001,
44.061333333333337,
27.848749999999999,
39.055,
16.539999999999999,
9.0562500000000004,
16.145,
22.844999999999999,
20.302500000000002,
1.05,
0.77625,
11.254999999999997,
55.103846153846149,
5.442499999999999,
7.5442857142857145,
6.0099999999999998,
9.6699999999999999,
3.4388888888888887,
24.295000000000002,
10.374285714285715,
1.1499999999999999,
4.2893333333333334,
5.0553333333333335,
9.7249999999999996,
12.419333333333332,
39.890000000000001,
17.149999999999999,
21.934999999999999,
17.3675,
10.445,
14.34,
31.237272727272728,
39.515000000000001,
0.93500000000000005,
0.80636363636363628,
12.654999999999999,
30.275454545454544,
6.4113333333333333,
7.1624999999999996,
9.9100000000000001,
9.8366666666666678,
18.244285714285716,
23.883333333333336,
12.5875,
1.8700000000000001,
5.7881818181818181,
6.3981818181818193,
11.270000000000001,
...]
In [13]:
df = link_df
df['starting_time'] = df['starting_time'].astype('datetime64[ns]')
#Get a 20 min sliding window for the dataframe
df_group = df.groupby([pd.Grouper(key='starting_time', freq='20min')])
df['link_travel_time'] = pd.to_numeric(df['link_travel_time'])
In [ ]:
In [14]:
weather_df
Out[14]:
date
hour
pressure
sea_pressure
wind_direction
wind_speed
temperature
rel_humidity
precipitation
wind_direction2
datetime
0
2016-07-01
0
1000.4
1005.3
225.0
2.1
26.4
94.0
0.0
2.1
2016-07-01 00:00:00
1
2016-07-01
3
1000.5
1005.3
187.0
2.7
29.0
76.0
0.0
2.7
2016-07-01 03:00:00
2
2016-07-01
6
998.9
1003.7
212.0
2.9
31.7
67.0
0.0
2.9
2016-07-01 06:00:00
3
2016-07-01
9
998.7
1003.5
244.0
2.7
31.6
59.0
0.0
2.7
2016-07-01 09:00:00
4
2016-07-01
12
999.7
1004.5
222.0
1.3
29.9
68.0
0.0
1.3
2016-07-01 12:00:00
5
2016-07-01
15
1000.0
1004.8
102.0
1.6
27.8
82.0
0.0
1.6
2016-07-01 15:00:00
6
2016-07-01
18
998.8
1003.6
202.0
1.9
26.0
89.0
0.0
1.9
2016-07-01 18:00:00
7
2016-07-01
21
1000.2
1005.0
334.0
2.2
25.5
90.0
0.0
2.2
2016-07-01 21:00:00
8
2016-07-02
0
1001.6
1006.4
315.0
1.8
26.8
82.0
0.0
1.8
2016-07-02 00:00:00
9
2016-07-02
3
1002.4
1007.2
46.0
3.2
30.0
70.0
0.0
3.2
2016-07-02 03:00:00
10
2016-07-02
6
1001.3
1006.2
37.0
2.2
29.3
80.0
1.0
2.2
2016-07-02 06:00:00
11
2016-07-02
9
1001.9
1006.8
345.0
2.4
25.9
95.0
10.2
2.4
2016-07-02 09:00:00
12
2016-07-02
12
1003.6
1008.5
113.0
1.0
25.1
94.0
0.2
1.0
2016-07-02 12:00:00
13
2016-07-02
15
1002.4
1007.3
138.0
1.0
25.3
96.0
0.0
1.0
2016-07-02 15:00:00
14
2016-07-02
18
1000.9
1005.8
221.0
0.7
25.4
96.0
0.0
0.7
2016-07-02 18:00:00
15
2016-07-02
21
1000.9
1005.8
999017.0
0.1
25.2
98.0
0.0
NaN
2016-07-02 21:00:00
16
2016-07-03
0
1001.5
1006.4
220.0
1.5
25.8
97.0
0.0
1.5
2016-07-03 00:00:00
17
2016-07-03
3
1001.5
1006.4
200.0
1.6
27.0
93.0
0.1
1.6
2016-07-03 03:00:00
18
2016-07-03
6
1000.8
1005.7
207.0
1.8
27.4
92.0
0.0
1.8
2016-07-03 06:00:00
19
2016-07-03
9
1000.8
1005.7
223.0
1.1
27.7
91.0
0.1
1.1
2016-07-03 09:00:00
20
2016-07-03
12
1001.6
1006.5
137.0
0.6
26.9
91.0
0.0
0.6
2016-07-03 12:00:00
21
2016-07-03
15
1002.2
1007.1
173.0
0.4
26.0
96.0
0.1
0.4
2016-07-03 15:00:00
22
2016-07-03
18
1000.5
1005.4
330.0
0.7
25.7
98.0
0.4
0.7
2016-07-03 18:00:00
23
2016-07-03
21
1000.4
1005.3
999017.0
0.0
25.7
98.0
0.0
NaN
2016-07-03 21:00:00
24
2016-07-04
0
1000.6
1005.5
176.0
2.0
26.3
97.0
0.0
2.0
2016-07-04 00:00:00
25
2016-07-04
3
1000.5
1005.3
179.0
2.1
31.8
69.0
0.0
2.1
2016-07-04 03:00:00
26
2016-07-04
6
999.7
1004.5
160.0
1.7
34.7
56.0
0.0
1.7
2016-07-04 06:00:00
27
2016-07-04
9
998.8
1003.6
287.0
1.4
34.8
55.0
0.0
1.4
2016-07-04 09:00:00
28
2016-07-04
12
1001.1
1006.0
340.0
1.0
29.7
78.0
0.0
1.0
2016-07-04 12:00:00
29
2016-07-04
15
1001.1
1005.9
188.0
1.3
27.8
79.0
0.0
1.3
2016-07-04 15:00:00
...
...
...
...
...
...
...
...
...
...
...
...
832
2016-10-14
6
1015.8
1020.9
359.0
1.9
18.5
84.0
0.0
1.9
2016-10-14 06:00:00
833
2016-10-14
9
1015.5
1020.6
349.0
2.0
18.2
81.0
0.0
2.0
2016-10-14 09:00:00
834
2016-10-14
12
1016.5
1021.6
1.0
1.4
18.3
83.0
0.0
1.4
2016-10-14 12:00:00
835
2016-10-14
15
1015.9
1021.0
354.0
1.8
18.2
87.0
0.0
1.8
2016-10-14 15:00:00
836
2016-10-14
18
1015.4
1020.5
202.0
1.1
18.4
89.0
0.0
1.1
2016-10-14 18:00:00
837
2016-10-14
21
1015.2
1020.3
360.0
2.3
18.5
90.0
0.0
2.3
2016-10-14 21:00:00
838
2016-10-15
0
1016.5
1021.6
35.0
2.0
19.0
95.0
0.0
2.0
2016-10-15 00:00:00
839
2016-10-15
3
1015.8
1020.9
357.0
1.1
19.8
94.0
0.6
1.1
2016-10-15 03:00:00
840
2016-10-15
6
1013.7
1018.8
334.0
1.5
20.3
96.0
0.1
1.5
2016-10-15 06:00:00
841
2016-10-15
9
1013.7
1018.8
333.0
2.2
20.3
96.0
0.0
2.2
2016-10-15 09:00:00
842
2016-10-15
12
1014.5
1019.6
344.0
0.9
20.0
97.0
0.0
0.9
2016-10-15 12:00:00
843
2016-10-15
15
1013.9
1019.0
999017.0
0.0
19.8
97.0
0.0
NaN
2016-10-15 15:00:00
844
2016-10-15
18
1012.9
1017.9
215.0
1.7
19.7
97.0
0.0
1.7
2016-10-15 18:00:00
845
2016-10-15
21
1012.8
1017.8
216.0
3.2
19.6
97.0
0.0
3.2
2016-10-15 21:00:00
846
2016-10-16
0
1013.9
1018.9
327.0
0.6
20.4
95.0
0.0
0.6
2016-10-16 00:00:00
847
2016-10-16
3
1013.9
1018.9
342.0
2.2
24.6
76.0
0.0
2.2
2016-10-16 03:00:00
848
2016-10-16
6
1011.7
1016.7
301.0
1.8
26.8
67.0
0.0
1.8
2016-10-16 06:00:00
849
2016-10-16
9
1011.7
1016.7
10.0
4.1
24.9
74.0
0.0
4.1
2016-10-16 09:00:00
850
2016-10-16
12
1013.8
1018.8
353.0
4.3
22.7
77.0
0.0
4.3
2016-10-16 12:00:00
851
2016-10-16
15
1014.7
1019.7
7.0
2.1
21.9
80.0
0.0
2.1
2016-10-16 15:00:00
852
2016-10-16
18
1014.5
1019.5
344.0
2.0
21.3
83.0
0.0
2.0
2016-10-16 18:00:00
853
2016-10-16
21
1014.2
1019.2
35.0
3.0
20.4
81.0
0.0
3.0
2016-10-16 21:00:00
854
2016-10-17
0
1015.6
1020.6
35.0
2.1
20.1
80.0
0.0
2.1
2016-10-17 00:00:00
855
2016-10-17
3
1015.6
1020.6
104.0
1.5
19.6
90.0
0.1
1.5
2016-10-17 03:00:00
856
2016-10-17
6
1013.4
1018.4
81.0
1.2
21.3
79.0
0.0
1.2
2016-10-17 06:00:00
857
2016-10-17
9
1013.7
1018.7
109.0
1.1
20.9
79.0
0.0
1.1
2016-10-17 09:00:00
858
2016-10-17
12
1014.3
1019.4
17.0
0.7
19.6
87.0
0.0
0.7
2016-10-17 12:00:00
859
2016-10-17
15
1014.7
1019.8
222.0
0.9
18.9
92.0
0.0
0.9
2016-10-17 15:00:00
860
2016-10-17
18
1014.0
1019.0
341.0
1.5
19.1
92.0
0.0
1.5
2016-10-17 18:00:00
861
2016-10-17
21
1013.9
1018.9
322.0
2.5
19.3
90.0
0.0
2.5
2016-10-17 21:00:00
862 rows × 11 columns
In [ ]:
In [16]:
#generate_timeInformationVector
#import src.VectorGeneration_xAsTimeInformation as vgati
#x2, y2 = vgati.generate_timeInformationVector(trajectories_df)
In [ ]:
In [48]:
df_orig = trajectories_df
# copy from michael
# Generate Y
df_orig['starting_time'] = df_orig['starting_time'].astype('datetime64[ns]')
# Get a 20 min sliding window for the dataframe
df_orig_group = df_orig.groupby([pd.Grouper(key='starting_time', freq='20min')])
mylist_Y = []
# Iterate over a sliding window dataframe
for name, group in df_orig_group:
# Get the averages travel time route
df_temp = group.groupby(['intersection_id', 'tollgate_id'])['travel_time'].mean().reset_index(
name="avg_travel_time")
np_arr = df_temp['avg_travel_time'].tolist()
mylist_Y.append(np_arr)
# Delete the first 6 elements because we are not interested in the first 6 time windows (first 2 hours)
# del mylist_Y[0:5]
# Concatenate the Y vector (np array) from the list of numpy arrays
Y = np.concatenate(mylist_Y)
Y
Out[48]:
array([ 70.85 , 58.05 , 79.76 , ..., 103.79 , 117.9 , 100.255])
In [26]:
trajectories_df['starting_time'].min()
Out[26]:
'2016-07-19 00:14:24'
In [27]:
trajectories_df['starting_time'].max()
Out[27]:
'2016-10-24 23:55:45'
In [31]:
res = np.datetime64(trajectories_df['starting_time'].max()) - np.datetime64(trajectories_df['starting_time'].min())
days = res.astype('timedelta64[D]')
days
Out[31]:
numpy.timedelta64(97,'D')
In [65]:
trajectories_df.sort(['intersection_id', 'tollgate_id'])
C:\Anaconda3\lib\site-packages\ipykernel\__main__.py:1: FutureWarning: sort(columns=....) is deprecated, use sort_values(by=.....)
if __name__ == '__main__':
Out[65]:
intersection_id
tollgate_id
vehicle_id
starting_time
travel_seq
travel_time
3
A
2
1071181
2016-07-19 00:37:59
110#2016-07-19 00:37:59#13.74;123#2016-07-19 0...
58.05
7
A
2
1063919
2016-07-19 01:36:04
110#2016-07-19 01:36:04#10.39;123#2016-07-19 0...
74.47
10
A
2
1002179
2016-07-19 01:38:48
110#2016-07-19 01:38:48#8.25;123#2016-07-19 01...
39.27
12
A
2
1004088
2016-07-19 01:42:22
110#2016-07-19 01:42:22#8.32;123#2016-07-19 01...
35.38
15
A
2
1022331
2016-07-19 01:48:40
110#2016-07-19 01:48:40#9.51;123#2016-07-19 01...
130.43
17
A
2
1004286
2016-07-19 01:52:08
110#2016-07-19 01:52:08#18.05;123#2016-07-19 0...
67.41
19
A
2
1065328
2016-07-19 02:20:16
110#2016-07-19 02:20:16#10.07;123#2016-07-19 0...
42.64
23
A
2
1027642
2016-07-19 02:42:22
110#2016-07-19 02:42:22#6.65;123#2016-07-19 02...
29.15
24
A
2
1005189
2016-07-19 02:42:24
110#2016-07-19 02:42:24#7.54;123#2016-07-19 02...
40.12
26
A
2
1056068
2016-07-19 02:58:39
110#2016-07-19 02:58:39#9.42;123#2016-07-19 02...
51.25
28
A
2
1055860
2016-07-19 03:27:36
110#2016-07-19 03:27:36#11.44;123#2016-07-19 0...
44.29
29
A
2
1085652
2016-07-19 03:36:02
110#2016-07-19 03:36:02#11.39;123#2016-07-19 0...
39.55
30
A
2
1006150
2016-07-19 03:42:57
110#2016-07-19 03:42:57#6.58;123#2016-07-19 03...
23.03
34
A
2
1063758
2016-07-19 03:44:07
110#2016-07-19 03:44:07#8.88;123#2016-07-19 03...
39.54
36
A
2
1057507
2016-07-19 03:56:20
110#2016-07-19 03:56:20#10.01;123#2016-07-19 0...
55.72
38
A
2
1057630
2016-07-19 04:06:25
110#2016-07-19 04:06:25#8.34;123#2016-07-19 04...
50.79
39
A
2
1053847
2016-07-19 04:06:25
110#2016-07-19 04:06:25#8.34;123#2016-07-19 04...
50.79
41
A
2
1000048
2016-07-19 04:12:47
110#2016-07-19 04:12:47#8.28;123#2016-07-19 04...
42.81
43
A
2
1065801
2016-07-19 04:26:33
110#2016-07-19 04:26:33#14.54;123#2016-07-19 0...
86.42
44
A
2
1022676
2016-07-19 04:27:37
110#2016-07-19 04:27:37#37.77;123#2016-07-19 0...
72.19
46
A
2
1000874
2016-07-19 04:30:45
110#2016-07-19 04:30:45#10.00;123#2016-07-19 0...
57.58
47
A
2
1001009
2016-07-19 04:30:46
110#2016-07-19 04:30:46#10.96;123#2016-07-19 0...
64.14
48
A
2
1035793
2016-07-19 04:38:13
110#2016-07-19 04:38:13#12.16;123#2016-07-19 0...
48.97
49
A
2
1010240
2016-07-19 04:38:35
110#2016-07-19 04:38:35#12.29;123#2016-07-19 0...
43.34
52
A
2
1009897
2016-07-19 04:44:00
110#2016-07-19 04:44:00#9.24;123#2016-07-19 04...
45.59
56
A
2
1057517
2016-07-19 04:54:12
110#2016-07-19 04:54:12#8.63;123#2016-07-19 04...
46.64
59
A
2
1055846
2016-07-19 05:06:06
110#2016-07-19 05:06:06#9.17;123#2016-07-19 05...
36.61
60
A
2
1027406
2016-07-19 05:08:07
110#2016-07-19 05:08:07#14.33;123#2016-07-19 0...
64.88
61
A
2
1065479
2016-07-19 05:09:34
110#2016-07-19 05:09:34#9.60;123#2016-07-19 05...
53.12
62
A
2
1058172
2016-07-19 05:10:11
110#2016-07-19 05:10:11#8.23;123#2016-07-19 05...
46.73
...
...
...
...
...
...
...
118918
C
3
1029280
2016-10-24 15:24:42
115#2016-10-24 15:24:42#9.91;102#2016-10-24 15...
114.41
118945
C
3
1012055
2016-10-24 15:39:23
115#2016-10-24 15:39:23#11.07;102#2016-10-24 1...
174.94
118949
C
3
1000375
2016-10-24 15:43:06
115#2016-10-24 15:43:06#8.12;102#2016-10-24 15...
188.20
118962
C
3
1026900
2016-10-24 15:48:33
115#2016-10-24 15:48:33#7.93;102#2016-10-24 15...
94.23
118964
C
3
1031834
2016-10-24 15:49:41
115#2016-10-24 15:49:41#31.94;102#2016-10-24 1...
307.96
118970
C
3
1049983
2016-10-24 15:51:20
115#2016-10-24 15:51:20#12.69;102#2016-10-24 1...
198.39
118978
C
3
1008179
2016-10-24 15:58:02
115#2016-10-24 15:58:02#7.95;102#2016-10-24 15...
254.73
118981
C
3
1037255
2016-10-24 15:59:19
115#2016-10-24 15:59:19#15.00;102#2016-10-24 1...
180.28
118997
C
3
1009029
2016-10-24 16:12:25
115#2016-10-24 16:12:25#11.58;102#2016-10-24 1...
184.11
119003
C
3
1048777
2016-10-24 16:15:35
115#2016-10-24 16:15:35#10.49;102#2016-10-24 1...
163.00
119005
C
3
1048537
2016-10-24 16:15:46
115#2016-10-24 16:15:46#8.84;102#2016-10-24 16...
130.99
119047
C
3
1038309
2016-10-24 16:48:40
115#2016-10-24 16:48:40#9.60;102#2016-10-24 16...
131.71
119052
C
3
1000571
2016-10-24 16:51:13
115#2016-10-24 16:51:13#8.28;102#2016-10-24 16...
132.80
119056
C
3
1047043
2016-10-24 16:52:15
115#2016-10-24 16:52:15#39.54;102#2016-10-24 1...
214.92
119069
C
3
1048358
2016-10-24 17:00:50
115#2016-10-24 17:00:50#7.79;102#2016-10-24 17...
194.52
119092
C
3
1019576
2016-10-24 17:12:45
115#2016-10-24 17:12:45#9.16;102#2016-10-24 17...
129.06
119108
C
3
1042078
2016-10-24 17:24:53
115#2016-10-24 17:24:53#9.38;102#2016-10-24 17...
257.10
119117
C
3
1042950
2016-10-24 17:30:40
115#2016-10-24 17:30:40#9.65;102#2016-10-24 17...
154.76
119120
C
3
1000334
2016-10-24 17:33:18
115#2016-10-24 17:33:18#12.80;102#2016-10-24 1...
113.31
119128
C
3
1029858
2016-10-24 17:38:03
115#2016-10-24 17:38:03#16.05;102#2016-10-24 1...
138.29
119136
C
3
1000570
2016-10-24 17:42:17
115#2016-10-24 17:42:17#8.44;102#2016-10-24 17...
111.53
119195
C
3
1037411
2016-10-24 18:38:21
115#2016-10-24 18:38:21#8.32;102#2016-10-24 18...
109.12
119257
C
3
1028917
2016-10-24 19:57:18
115#2016-10-24 19:57:18#9.98;102#2016-10-24 19...
155.13
119269
C
3
1009309
2016-10-24 20:09:58
115#2016-10-24 20:09:58#6.93;102#2016-10-24 20...
120.22
119270
C
3
1041727
2016-10-24 20:10:01
115#2016-10-24 20:10:01#6.56;102#2016-10-24 20...
99.13
119276
C
3
1010457
2016-10-24 20:17:22
115#2016-10-24 20:17:22#13.95;102#2016-10-24 2...
241.52
119277
C
3
1044881
2016-10-24 20:17:24
115#2016-10-24 20:17:24#10.62;102#2016-10-24 2...
233.08
119279
C
3
1016357
2016-10-24 20:19:14
115#2016-10-24 20:19:14#13.65;102#2016-10-24 2...
363.04
119289
C
3
1010572
2016-10-24 20:33:27
115#2016-10-24 20:33:27#9.22;102#2016-10-24 20...
103.08
119324
C
3
1041543
2016-10-24 21:38:23
115#2016-10-24 21:38:23#6.44;102#2016-10-24 21...
98.82
119380 rows × 6 columns
In [71]:
#y
df = trajectories_df
df['starting_time'] = df_orig['starting_time'].astype('datetime64[ns]')
df_y = df.groupby(['intersection_id', 'tollgate_id', pd.TimeGrouper(key='starting_time', freq='20min')])['travel_time'].mean()
df_y
Out[71]:
intersection_id tollgate_id starting_time
A 2 2016-07-19 00:20:00 58.050000
2016-07-19 01:20:00 56.870000
2016-07-19 01:40:00 77.740000
2016-07-19 02:20:00 42.640000
2016-07-19 02:40:00 40.173333
2016-07-19 03:20:00 41.920000
2016-07-19 03:40:00 39.430000
2016-07-19 04:00:00 48.130000
2016-07-19 04:20:00 62.106667
2016-07-19 04:40:00 46.115000
2016-07-19 05:00:00 49.556000
2016-07-19 05:20:00 54.840000
2016-07-19 05:40:00 58.084286
2016-07-19 06:00:00 46.356000
2016-07-19 06:20:00 48.588000
2016-07-19 06:40:00 66.642500
2016-07-19 07:00:00 64.681000
2016-07-19 07:20:00 85.676000
2016-07-19 07:40:00 58.968889
2016-07-19 08:00:00 81.602857
2016-07-19 08:20:00 80.207857
2016-07-19 08:40:00 63.448462
2016-07-19 09:00:00 78.051176
2016-07-19 09:20:00 69.038333
2016-07-19 09:40:00 69.657143
2016-07-19 10:00:00 78.311538
2016-07-19 10:20:00 59.411818
2016-07-19 10:40:00 75.488889
2016-07-19 11:00:00 72.435000
2016-07-19 11:20:00 45.942500
...
C 3 2016-10-24 06:40:00 207.330000
2016-10-24 07:00:00 164.372500
2016-10-24 07:20:00 292.920000
2016-10-24 08:40:00 141.635000
2016-10-24 09:20:00 142.250000
2016-10-24 09:40:00 169.265000
2016-10-24 10:20:00 139.233333
2016-10-24 10:40:00 169.810000
2016-10-24 11:20:00 166.610000
2016-10-24 11:40:00 111.110000
2016-10-24 12:00:00 155.410000
2016-10-24 12:20:00 130.790000
2016-10-24 13:20:00 140.876000
2016-10-24 13:40:00 188.025000
2016-10-24 14:00:00 198.340000
2016-10-24 14:20:00 158.030000
2016-10-24 14:40:00 125.450000
2016-10-24 15:00:00 183.315000
2016-10-24 15:20:00 144.675000
2016-10-24 15:40:00 203.965000
2016-10-24 16:00:00 159.366667
2016-10-24 16:40:00 159.810000
2016-10-24 17:00:00 161.790000
2016-10-24 17:20:00 165.865000
2016-10-24 17:40:00 111.530000
2016-10-24 18:20:00 109.120000
2016-10-24 19:40:00 155.130000
2016-10-24 20:00:00 211.398000
2016-10-24 20:20:00 103.080000
2016-10-24 21:20:00 98.820000
Name: travel_time, dtype: float64
In [125]:
#y
df = trajectories_df
df['starting_time'] = df['starting_time'].astype('datetime64[ns]')
df_y = df.groupby(['intersection_id', 'tollgate_id', pd.TimeGrouper(key='starting_time', freq='20min')]).mean()
date_index = pd.date_range(start='19/7/2016', end='24/10/2016', freq='20min')
#multi_index = pd.MultiIndex(levels=[['A', 'B', 'C'], [1, 2, 3],date_index], labels=[0, 1, 2], names=['intersection_id', 'tollgate_id', 'starting_time'])
#df_y.reindex(['intersection_id','tollgate_id',date_index], fill_value=0)
date_index
#multi_index
df_y
Out[125]:
vehicle_id
travel_time
intersection_id
tollgate_id
starting_time
A
2
2016-07-19 00:20:00
1071181
58.050000
2016-07-19 01:20:00
1033049
56.870000
2016-07-19 01:40:00
1010235
77.740000
2016-07-19 02:20:00
1065328
42.640000
2016-07-19 02:40:00
1029633
40.173333
2016-07-19 03:20:00
1070756
41.920000
2016-07-19 03:40:00
1042471
39.430000
2016-07-19 04:00:00
1037175
48.130000
2016-07-19 04:20:00
1022732
62.106667
2016-07-19 04:40:00
1033707
46.115000
2016-07-19 05:00:00
1058511
49.556000
2016-07-19 05:20:00
1053060
54.840000
2016-07-19 05:40:00
1053909
58.084286
2016-07-19 06:00:00
1061597
46.356000
2016-07-19 06:20:00
1029370
48.588000
2016-07-19 06:40:00
1061361
66.642500
2016-07-19 07:00:00
1061110
64.681000
2016-07-19 07:20:00
1043710
85.676000
2016-07-19 07:40:00
1053913
58.968889
2016-07-19 08:00:00
1057509
81.602857
2016-07-19 08:20:00
1050985
80.207857
2016-07-19 08:40:00
1044838
63.448462
2016-07-19 09:00:00
1048642
78.051176
2016-07-19 09:20:00
1055100
69.038333
2016-07-19 09:40:00
1064208
69.657143
2016-07-19 10:00:00
1052306
78.311538
2016-07-19 10:20:00
1050102
59.411818
2016-07-19 10:40:00
1054630
75.488889
2016-07-19 11:00:00
1038096
72.435000
2016-07-19 11:20:00
1055872
45.942500
...
...
...
...
...
C
3
2016-10-24 06:40:00
1012267
207.330000
2016-10-24 07:00:00
1022567
164.372500
2016-10-24 07:20:00
1011536
292.920000
2016-10-24 08:40:00
1024282
141.635000
2016-10-24 09:20:00
1032061
142.250000
2016-10-24 09:40:00
1040524
169.265000
2016-10-24 10:20:00
1032994
139.233333
2016-10-24 10:40:00
1016642
169.810000
2016-10-24 11:20:00
1015575
166.610000
2016-10-24 11:40:00
1048192
111.110000
2016-10-24 12:00:00
1018239
155.410000
2016-10-24 12:20:00
1035438
130.790000
2016-10-24 13:20:00
1024652
140.876000
2016-10-24 13:40:00
1033999
188.025000
2016-10-24 14:00:00
1042231
198.340000
2016-10-24 14:20:00
1029148
158.030000
2016-10-24 14:40:00
1005437
125.450000
2016-10-24 15:00:00
1027158
183.315000
2016-10-24 15:20:00
1020667
144.675000
2016-10-24 15:40:00
1025754
203.965000
2016-10-24 16:00:00
1035447
159.366667
2016-10-24 16:40:00
1028641
159.810000
2016-10-24 17:00:00
1033967
161.790000
2016-10-24 17:20:00
1028805
165.865000
2016-10-24 17:40:00
1000570
111.530000
2016-10-24 18:20:00
1037411
109.120000
2016-10-24 19:40:00
1028917
155.130000
2016-10-24 20:00:00
1024546
211.398000
2016-10-24 20:20:00
1010572
103.080000
2016-10-24 21:20:00
1041543
98.820000
27312 rows × 2 columns
In [155]:
df_y2 = df_y.reset_index()
#df_y2 = df_y2.set_index('starting_time')
date_index = pd.date_range(start='19/7/2016', end='24/10/2016', freq='20min')
df_y2
#df_y2.reindex(date_index, fill_value="NaN")
df_y2.reindex(index=date_index)
Out[155]:
intersection_id
tollgate_id
starting_time
vehicle_id
travel_time
0
A
2
2016-07-19 00:20:00
1071181
58.050000
1
A
2
2016-07-19 01:20:00
1033049
56.870000
2
A
2
2016-07-19 01:40:00
1010235
77.740000
3
A
2
2016-07-19 02:20:00
1065328
42.640000
4
A
2
2016-07-19 02:40:00
1029633
40.173333
5
A
2
2016-07-19 03:20:00
1070756
41.920000
6
A
2
2016-07-19 03:40:00
1042471
39.430000
7
A
2
2016-07-19 04:00:00
1037175
48.130000
8
A
2
2016-07-19 04:20:00
1022732
62.106667
9
A
2
2016-07-19 04:40:00
1033707
46.115000
10
A
2
2016-07-19 05:00:00
1058511
49.556000
11
A
2
2016-07-19 05:20:00
1053060
54.840000
12
A
2
2016-07-19 05:40:00
1053909
58.084286
13
A
2
2016-07-19 06:00:00
1061597
46.356000
14
A
2
2016-07-19 06:20:00
1029370
48.588000
15
A
2
2016-07-19 06:40:00
1061361
66.642500
16
A
2
2016-07-19 07:00:00
1061110
64.681000
17
A
2
2016-07-19 07:20:00
1043710
85.676000
18
A
2
2016-07-19 07:40:00
1053913
58.968889
19
A
2
2016-07-19 08:00:00
1057509
81.602857
20
A
2
2016-07-19 08:20:00
1050985
80.207857
21
A
2
2016-07-19 08:40:00
1044838
63.448462
22
A
2
2016-07-19 09:00:00
1048642
78.051176
23
A
2
2016-07-19 09:20:00
1055100
69.038333
24
A
2
2016-07-19 09:40:00
1064208
69.657143
25
A
2
2016-07-19 10:00:00
1052306
78.311538
26
A
2
2016-07-19 10:20:00
1050102
59.411818
27
A
2
2016-07-19 10:40:00
1054630
75.488889
28
A
2
2016-07-19 11:00:00
1038096
72.435000
29
A
2
2016-07-19 11:20:00
1055872
45.942500
...
...
...
...
...
...
27282
C
3
2016-10-24 06:40:00
1012267
207.330000
27283
C
3
2016-10-24 07:00:00
1022567
164.372500
27284
C
3
2016-10-24 07:20:00
1011536
292.920000
27285
C
3
2016-10-24 08:40:00
1024282
141.635000
27286
C
3
2016-10-24 09:20:00
1032061
142.250000
27287
C
3
2016-10-24 09:40:00
1040524
169.265000
27288
C
3
2016-10-24 10:20:00
1032994
139.233333
27289
C
3
2016-10-24 10:40:00
1016642
169.810000
27290
C
3
2016-10-24 11:20:00
1015575
166.610000
27291
C
3
2016-10-24 11:40:00
1048192
111.110000
27292
C
3
2016-10-24 12:00:00
1018239
155.410000
27293
C
3
2016-10-24 12:20:00
1035438
130.790000
27294
C
3
2016-10-24 13:20:00
1024652
140.876000
27295
C
3
2016-10-24 13:40:00
1033999
188.025000
27296
C
3
2016-10-24 14:00:00
1042231
198.340000
27297
C
3
2016-10-24 14:20:00
1029148
158.030000
27298
C
3
2016-10-24 14:40:00
1005437
125.450000
27299
C
3
2016-10-24 15:00:00
1027158
183.315000
27300
C
3
2016-10-24 15:20:00
1020667
144.675000
27301
C
3
2016-10-24 15:40:00
1025754
203.965000
27302
C
3
2016-10-24 16:00:00
1035447
159.366667
27303
C
3
2016-10-24 16:40:00
1028641
159.810000
27304
C
3
2016-10-24 17:00:00
1033967
161.790000
27305
C
3
2016-10-24 17:20:00
1028805
165.865000
27306
C
3
2016-10-24 17:40:00
1000570
111.530000
27307
C
3
2016-10-24 18:20:00
1037411
109.120000
27308
C
3
2016-10-24 19:40:00
1028917
155.130000
27309
C
3
2016-10-24 20:00:00
1024546
211.398000
27310
C
3
2016-10-24 20:20:00
1010572
103.080000
27311
C
3
2016-10-24 21:20:00
1041543
98.820000
27312 rows × 5 columns
Content source: Superchicken1/SambaFlow
Similar notebooks: