Time Series Interpolation, Slices, and Joins#

One of the major problems with working with time series models is cleaning the data. Most time series models need to have equally sliced data, and most tools don’t offer an easy way to do this.

Not only that, but missing values can distort predictions. You can fill these gaps with various interpolation methods.

Luckily, VerticaPy can easily slice and interpolate time series data. We’ll demonstrate these functions with the ‘Smart Meter’ dataset.

[8]:
import verticapy as vp
sm_consumption = vp.read_csv("data/sm_consumption.csv")
display(sm_consumption)
123
meterID
Int
📅
dateUTC
Timestamp
123
value
Numeric(10,6)
102014-01-01 11:00:000.029
202014-01-01 13:45:000.277
302014-01-02 10:45:000.321
402014-01-02 11:15:000.305
502014-01-02 13:45:000.358
602014-01-02 15:30:000.115
702014-01-03 08:30:000.071
802014-01-04 23:45:000.323
902014-01-06 01:15:000.085
1002014-01-06 21:45:000.713
1102014-01-07 00:15:000.242
1202014-01-07 23:00:000.09
1302014-01-09 05:30:000.115
1402014-01-09 15:00:000.928
1502014-01-09 18:15:001.09
1602014-01-10 10:00:000.07
1702014-01-10 14:30:0010.832
1802014-01-10 15:30:003.288
1902014-01-10 18:00:000.42
2002014-01-11 10:45:001.045
2102014-01-12 07:45:000.091
2202014-01-13 19:45:000.249
2302014-01-13 20:15:000.34
2402014-01-14 13:00:000.099
2502014-01-14 14:00:000.2
2602014-01-14 14:45:000.865
2702014-01-14 22:00:000.716
2802014-01-15 03:45:000.05
2902014-01-15 11:15:000.052
3002014-01-15 11:30:000.038
3102014-01-15 23:15:000.239
3202014-01-16 19:30:001.422
3302014-01-17 15:00:000.291
3402014-01-18 00:30:000.828
3502014-01-19 03:00:000.017
3602014-01-19 05:30:000.024
3702014-01-19 06:15:000.048
3802014-01-19 15:30:0013.3
3902014-01-20 19:30:000.59
4002014-01-21 12:30:000.327
4102014-01-21 13:30:000.108
4202014-01-22 01:30:000.083
4302014-01-22 04:30:000.044
4402014-01-23 21:00:000.226
4502014-01-24 02:00:000.125
4602014-01-24 12:15:000.168
4702014-01-27 22:45:000.495
4802014-01-28 06:15:000.056
4902014-01-28 11:30:000.113
5002014-01-28 19:00:001.566
5102014-01-28 19:45:001.108
5202014-01-29 05:00:000.064
5302014-01-29 07:45:000.145
5402014-01-29 13:00:001.719
5502014-01-30 06:15:000.059
5602014-01-30 17:45:000.575
5702014-01-30 18:45:001.129
5802014-02-01 03:30:000.057
5902014-02-01 03:45:000.059
6002014-02-02 08:45:000.186
6102014-02-04 03:45:000.045
6202014-02-04 12:00:000.187
6302014-02-04 16:00:000.313
6402014-02-04 18:45:000.912
6502014-02-05 06:45:000.018
6602014-02-05 17:15:000.112
6702014-02-06 15:15:0010.146
6802014-02-07 11:00:000.868
6902014-02-07 17:30:003.812
7002014-02-07 22:15:001.262
7102014-02-08 03:45:000.043
7202014-02-08 06:45:000.106
7302014-02-09 04:15:000.449
7402014-02-09 08:30:000.007
7502014-02-11 02:30:000.087
7602014-02-11 05:30:000.039
7702014-02-11 19:00:000.094
7802014-02-12 02:30:000.102
7902014-02-13 02:45:000.097
8002014-02-13 09:30:000.161
8102014-02-13 19:00:001.147
8202014-02-14 00:15:000.084
8302014-02-14 02:00:000.174
8402014-02-14 11:15:000.05
8502014-02-14 13:45:000.033
8602014-02-15 02:00:000.181
8702014-02-15 13:45:000.031
8802014-02-15 15:00:000.483
8902014-02-15 20:15:000.368
9002014-02-16 00:00:000.195
9102014-02-17 02:45:000.094
9202014-02-17 12:45:000.049
9302014-02-17 15:15:000.008
9402014-02-18 05:00:000.041
9502014-02-18 20:15:001.202
9602014-02-19 00:15:000.148
9702014-02-19 07:00:000.095
9802014-02-20 00:15:000.039
9902014-02-20 07:30:000.213
10002014-02-20 19:00:001.208
Rows: 1-100 | Columns: 3

Our dataset has a lot of gaps, so let’s slice and interpolate the energy consumption every 30 minutes.

[9]:
interpolate = sm_consumption.interpolate(ts = "dateUTC",
                                         rule = "30 minutes",
                                         method = {"value": "linear"},
                                         by = ["meterID"])
display(interpolate)
📅
dateUTC
Datetime
123
meterID
Integer
123
value
Float
12014-01-01 11:00:0000.029
22014-01-01 11:30:0000.0740909090909091
32014-01-01 12:00:0000.119181818181818
42014-01-01 12:30:0000.164272727272727
52014-01-01 13:00:0000.209363636363636
62014-01-01 13:30:0000.254454545454545
72014-01-01 14:00:0000.27752380952381
82014-01-01 14:30:0000.278571428571429
92014-01-01 15:00:0000.279619047619048
102014-01-01 15:30:0000.280666666666667
112014-01-01 16:00:0000.281714285714286
122014-01-01 16:30:0000.282761904761905
132014-01-01 17:00:0000.283809523809524
142014-01-01 17:30:0000.284857142857143
152014-01-01 18:00:0000.285904761904762
162014-01-01 18:30:0000.286952380952381
172014-01-01 19:00:0000.288
182014-01-01 19:30:0000.289047619047619
192014-01-01 20:00:0000.290095238095238
202014-01-01 20:30:0000.291142857142857
212014-01-01 21:00:0000.292190476190476
222014-01-01 21:30:0000.293238095238095
232014-01-01 22:00:0000.294285714285714
242014-01-01 22:30:0000.295333333333333
252014-01-01 23:00:0000.296380952380952
262014-01-01 23:30:0000.297428571428571
272014-01-02 00:00:0000.298476190476191
282014-01-02 00:30:0000.29952380952381
292014-01-02 01:00:0000.300571428571429
302014-01-02 01:30:0000.301619047619048
312014-01-02 02:00:0000.302666666666667
322014-01-02 02:30:0000.303714285714286
332014-01-02 03:00:0000.304761904761905
342014-01-02 03:30:0000.305809523809524
352014-01-02 04:00:0000.306857142857143
362014-01-02 04:30:0000.307904761904762
372014-01-02 05:00:0000.308952380952381
382014-01-02 05:30:0000.31
392014-01-02 06:00:0000.311047619047619
402014-01-02 06:30:0000.312095238095238
412014-01-02 07:00:0000.313142857142857
422014-01-02 07:30:0000.314190476190476
432014-01-02 08:00:0000.315238095238095
442014-01-02 08:30:0000.316285714285714
452014-01-02 09:00:0000.317333333333333
462014-01-02 09:30:0000.318380952380952
472014-01-02 10:00:0000.319428571428571
482014-01-02 10:30:0000.32047619047619
492014-01-02 11:00:0000.313
502014-01-02 11:30:0000.3103
512014-01-02 12:00:0000.3209
522014-01-02 12:30:0000.3315
532014-01-02 13:00:0000.3421
542014-01-02 13:30:0000.3527
552014-01-02 14:00:0000.323285714285714
562014-01-02 14:30:0000.253857142857143
572014-01-02 15:00:0000.184428571428571
582014-01-02 15:30:0000.115
592014-01-02 16:00:0000.113705882352941
602014-01-02 16:30:0000.112411764705882
612014-01-02 17:00:0000.111117647058824
622014-01-02 17:30:0000.109823529411765
632014-01-02 18:00:0000.108529411764706
642014-01-02 18:30:0000.107235294117647
652014-01-02 19:00:0000.105941176470588
662014-01-02 19:30:0000.104647058823529
672014-01-02 20:00:0000.103352941176471
682014-01-02 20:30:0000.102058823529412
692014-01-02 21:00:0000.100764705882353
702014-01-02 21:30:0000.0994705882352941
712014-01-02 22:00:0000.0981764705882353
722014-01-02 22:30:0000.0968823529411765
732014-01-02 23:00:0000.0955882352941176
742014-01-02 23:30:0000.0942941176470588
752014-01-03 00:00:0000.093
762014-01-03 00:30:0000.0917058823529412
772014-01-03 01:00:0000.0904117647058824
782014-01-03 01:30:0000.0891176470588235
792014-01-03 02:00:0000.0878235294117647
802014-01-03 02:30:0000.0865294117647059
812014-01-03 03:00:0000.0852352941176471
822014-01-03 03:30:0000.0839411764705882
832014-01-03 04:00:0000.0826470588235294
842014-01-03 04:30:0000.0813529411764706
852014-01-03 05:00:0000.0800588235294118
862014-01-03 05:30:0000.0787647058823529
872014-01-03 06:00:0000.0774705882352941
882014-01-03 06:30:0000.0761764705882353
892014-01-03 07:00:0000.0748823529411765
902014-01-03 07:30:0000.0735882352941176
912014-01-03 08:00:0000.0722941176470588
922014-01-03 08:30:0000.071
932014-01-03 09:00:0000.0742101910828025
942014-01-03 09:30:0000.0774203821656051
952014-01-03 10:00:0000.0806305732484076
962014-01-03 10:30:0000.0838407643312102
972014-01-03 11:00:0000.0870509554140127
982014-01-03 11:30:0000.0902611464968153
992014-01-03 12:00:0000.0934713375796178
1002014-01-03 12:30:0000.0966815286624204
Rows: 1-100 | Columns: 3

VerticaPy achieves this with its close integration with Vertica; by leveraging Vertica’s comutational power and the TIMESERIES clause, slicing and interpolation is easy.

[10]:
print(interpolate.current_relation())
(
   SELECT
     "dateUTC",
     "meterID",
     "value"
   FROM
 (
   SELECT
     slice_time AS "dateUTC",
     "meterID",
     TS_FIRST_VALUE("value", 'linear') AS "value"
   FROM
 "v_temp_schema"."_verticapy_tmp_sm_consumption_dbadmin_186831_8687362587_" TIMESERIES slice_time AS '30 minutes' OVER (PARTITION BY "meterID" ORDER BY "dateUTC"::timestamp)) interpolate)
VERTICAPY_SUBTABLE

Having sliced data on regular interval of time can often make it easier to join your the data with other datasets. For example, let’s join the ‘weather’ dataset with the ‘smart_meters_consumption’ dataset on ‘dateUTC’.

[12]:
sm_weather = vp.read_csv("data/sm_weather.csv")
display(sm_weather)
📅
dateUTC
Timestamp
123
temperature
Numeric(10,6)
123
humidity
Numeric(11,6)
12014-01-01 00:00:0038.095.0
22014-01-01 00:30:0037.493.0
32014-01-01 01:00:0037.4100.0
42014-01-01 01:30:0037.4100.0
52014-01-01 02:00:0039.293.0
62014-01-01 02:30:0039.293.0
72014-01-01 03:00:0039.293.0
82014-01-01 03:30:0039.293.0
92014-01-01 04:00:0039.293.0
102014-01-01 04:30:0039.293.0
112014-01-01 05:00:0039.293.0
122014-01-01 05:30:0039.287.0
132014-01-01 06:00:0038.089.0
142014-01-01 06:30:0037.493.0
152014-01-01 07:00:0037.493.0
162014-01-01 07:30:0037.493.0
172014-01-01 08:00:0037.493.0
182014-01-01 08:30:0037.487.0
192014-01-01 09:00:0037.487.0
202014-01-01 09:30:0037.487.0
212014-01-01 10:00:0037.493.0
222014-01-01 10:30:0037.493.0
232014-01-01 11:00:0037.487.0
242014-01-01 11:30:0037.493.0
252014-01-01 12:00:0038.085.0
262014-01-01 12:30:0039.287.0
272014-01-01 13:00:0039.287.0
282014-01-01 13:30:0039.287.0
292014-01-01 14:00:0039.287.0
302014-01-01 14:30:0039.287.0
312014-01-01 15:00:0039.287.0
322014-01-01 15:30:0039.287.0
332014-01-01 16:00:0037.493.0
342014-01-01 16:30:0039.287.0
352014-01-01 17:00:0039.287.0
362014-01-01 17:30:0037.487.0
372014-01-01 18:00:0038.081.0
382014-01-01 18:30:0037.487.0
392014-01-01 19:00:0035.687.0
402014-01-01 19:30:0037.493.0
412014-01-01 20:00:0039.287.0
422014-01-01 20:30:0039.287.0
432014-01-01 21:00:0039.287.0
442014-01-01 21:30:0041.081.0
452014-01-01 22:00:0039.287.0
462014-01-01 22:30:0039.287.0
472014-01-01 23:00:0039.287.0
482014-01-01 23:30:0039.281.0
492014-01-02 00:00:0038.076.0
502014-01-02 00:30:0037.481.0
512014-01-02 01:00:0037.481.0
522014-01-02 01:30:0037.481.0
532014-01-02 02:00:0037.481.0
542014-01-02 02:30:0037.481.0
552014-01-02 03:00:0037.481.0
562014-01-02 03:30:0037.481.0
572014-01-02 04:00:0037.481.0
582014-01-02 04:30:0035.687.0
592014-01-02 05:00:0035.693.0
602014-01-02 05:30:0037.481.0
612014-01-02 06:00:0037.075.0
622014-01-02 06:30:0037.481.0
632014-01-02 07:00:0037.487.0
642014-01-02 07:30:0037.481.0
652014-01-02 08:00:0035.681.0
662014-01-02 08:30:0035.681.0
672014-01-02 09:00:0037.475.0
682014-01-02 09:30:0037.481.0
692014-01-02 10:00:0039.275.0
702014-01-02 10:30:0041.070.0
712014-01-02 11:00:0039.275.0
722014-01-02 11:30:0041.070.0
732014-01-02 12:00:0041.061.0
742014-01-02 12:30:0041.070.0
752014-01-02 13:00:0041.076.0
762014-01-02 13:30:0041.076.0
772014-01-02 14:00:0041.076.0
782014-01-02 14:30:0041.076.0
792014-01-02 15:00:0041.076.0
802014-01-02 15:30:0041.076.0
812014-01-02 16:00:0041.076.0
822014-01-02 16:30:0041.076.0
832014-01-02 17:00:0041.076.0
842014-01-02 17:30:0039.281.0
852014-01-02 18:00:0039.070.0
862014-01-02 18:30:0037.481.0
872014-01-02 19:00:0039.275.0
882014-01-02 19:30:0037.481.0
892014-01-02 20:00:0037.481.0
902014-01-02 20:30:0039.275.0
912014-01-02 21:00:0039.265.0
922014-01-02 21:30:0039.265.0
932014-01-02 22:00:0039.265.0
942014-01-02 22:30:0039.261.0
952014-01-02 23:00:0039.261.0
962014-01-02 23:30:0039.265.0
972014-01-03 00:00:0039.048.0
982014-01-03 00:30:0039.261.0
992014-01-03 01:00:0039.265.0
1002014-01-03 01:30:0037.470.0
Rows: 1-100 | Columns: 3

Since the data was ingested at regular intervals of 30 minutes, we can join this dataset using ‘dateUTC’ as the key.

[13]:
interpolate.join(sm_weather,
                 how = "left",
                 on = {"dateUTC": "dateUTC"},
                 expr2 = ["temperature", "humidity"])
[13]:
📅
dateUTC
Datetime
123
meterID
Integer
123
value
Float
123
temperature
Numeric(10,6)
123
humidity
Numeric(11,6)
12014-01-01 11:00:0000.02937.487.0
22014-01-01 11:30:0000.074090909090909137.493.0
32014-01-01 12:00:0000.11918181818181838.085.0
42014-01-01 12:30:0000.16427272727272739.287.0
52014-01-01 13:00:0000.20936363636363639.287.0
62014-01-01 13:30:0000.25445454545454539.287.0
72014-01-01 14:00:0000.2775238095238139.287.0
82014-01-01 14:30:0000.27857142857142939.287.0
92014-01-01 15:00:0000.27961904761904839.287.0
102014-01-01 15:30:0000.28066666666666739.287.0
112014-01-01 16:00:0000.28171428571428637.493.0
122014-01-01 16:30:0000.28276190476190539.287.0
132014-01-01 17:00:0000.28380952380952439.287.0
142014-01-01 17:30:0000.28485714285714337.487.0
152014-01-01 18:00:0000.28590476190476238.081.0
162014-01-01 18:30:0000.28695238095238137.487.0
172014-01-01 19:00:0000.28835.687.0
182014-01-01 19:30:0000.28904761904761937.493.0
192014-01-01 20:00:0000.29009523809523839.287.0
202014-01-01 20:30:0000.29114285714285739.287.0
212014-01-01 21:00:0000.29219047619047639.287.0
222014-01-01 21:30:0000.29323809523809541.081.0
232014-01-01 22:00:0000.29428571428571439.287.0
242014-01-01 22:30:0000.29533333333333339.287.0
252014-01-01 23:00:0000.29638095238095239.287.0
262014-01-01 23:30:0000.29742857142857139.281.0
272014-01-02 00:00:0000.29847619047619138.076.0
282014-01-02 00:30:0000.2995238095238137.481.0
292014-01-02 01:00:0000.30057142857142937.481.0
302014-01-02 01:30:0000.30161904761904837.481.0
312014-01-02 02:00:0000.30266666666666737.481.0
322014-01-02 02:30:0000.30371428571428637.481.0
332014-01-02 03:00:0000.30476190476190537.481.0
342014-01-02 03:30:0000.30580952380952437.481.0
352014-01-02 04:00:0000.30685714285714337.481.0
362014-01-02 04:30:0000.30790476190476235.687.0
372014-01-02 05:00:0000.30895238095238135.693.0
382014-01-02 05:30:0000.3137.481.0
392014-01-02 06:00:0000.31104761904761937.075.0
402014-01-02 06:30:0000.31209523809523837.481.0
412014-01-02 07:00:0000.31314285714285737.487.0
422014-01-02 07:30:0000.31419047619047637.481.0
432014-01-02 08:00:0000.31523809523809535.681.0
442014-01-02 08:30:0000.31628571428571435.681.0
452014-01-02 09:00:0000.31733333333333337.475.0
462014-01-02 09:30:0000.31838095238095237.481.0
472014-01-02 10:00:0000.31942857142857139.275.0
482014-01-02 10:30:0000.3204761904761941.070.0
492014-01-02 11:00:0000.31339.275.0
502014-01-02 11:30:0000.310341.070.0
512014-01-02 12:00:0000.320941.061.0
522014-01-02 12:30:0000.331541.070.0
532014-01-02 13:00:0000.342141.076.0
542014-01-02 13:30:0000.352741.076.0
552014-01-02 14:00:0000.32328571428571441.076.0
562014-01-02 14:30:0000.25385714285714341.076.0
572014-01-02 15:00:0000.18442857142857141.076.0
582014-01-02 15:30:0000.11541.076.0
592014-01-02 16:00:0000.11370588235294141.076.0
602014-01-02 16:30:0000.11241176470588241.076.0
612014-01-02 17:00:0000.11111764705882441.076.0
622014-01-02 17:30:0000.10982352941176539.281.0
632014-01-02 18:00:0000.10852941176470639.070.0
642014-01-02 18:30:0000.10723529411764737.481.0
652014-01-02 19:00:0000.10594117647058839.275.0
662014-01-02 19:30:0000.10464705882352937.481.0
672014-01-02 20:00:0000.10335294117647137.481.0
682014-01-02 20:30:0000.10205882352941239.275.0
692014-01-02 21:00:0000.10076470588235339.265.0
702014-01-02 21:30:0000.099470588235294139.265.0
712014-01-02 22:00:0000.098176470588235339.265.0
722014-01-02 22:30:0000.096882352941176539.261.0
732014-01-02 23:00:0000.095588235294117639.261.0
742014-01-02 23:30:0000.094294117647058839.265.0
752014-01-03 00:00:0000.09339.048.0
762014-01-03 00:30:0000.091705882352941239.261.0
772014-01-03 01:00:0000.090411764705882439.265.0
782014-01-03 01:30:0000.089117647058823537.470.0
792014-01-03 02:00:0000.087823529411764737.470.0
802014-01-03 02:30:0000.086529411764705937.470.0
812014-01-03 03:00:0000.085235294117647137.470.0
822014-01-03 03:30:0000.083941176470588237.470.0
832014-01-03 04:00:0000.082647058823529437.470.0
842014-01-03 04:30:0000.081352941176470637.470.0
852014-01-03 05:00:0000.080058823529411837.470.0
862014-01-03 05:30:0000.078764705882352939.261.0
872014-01-03 06:00:0000.077470588235294138.050.0
882014-01-03 06:30:0000.076176470588235337.465.0
892014-01-03 07:00:0000.074882352941176539.261.0
902014-01-03 07:30:0000.073588235294117637.465.0
912014-01-03 08:00:0000.072294117647058837.465.0
922014-01-03 08:30:0000.07137.465.0
932014-01-03 09:00:0000.074210191082802537.465.0
942014-01-03 09:30:0000.077420382165605137.465.0
952014-01-03 10:00:0000.080630573248407637.465.0
962014-01-03 10:30:0000.083840764331210239.261.0
972014-01-03 11:00:0000.087050955414012739.256.0
982014-01-03 11:30:0000.090261146496815339.261.0
992014-01-03 12:00:0000.093471337579617839.048.0
1002014-01-03 12:30:0000.096681528662420439.261.0
Rows: 1-100 | Columns: 5

Keep in mind that slicing, interpolating, and joins can be computationally expensive.

Thanks to Vertica’s built-in clauses and options, VerticaPy can perform joins based on interpolated data. In the following example, we’ll have Vertica identify the closest time series to our key and merge the two datasets.

[14]:
sm_consumption.join(sm_weather,
                    how = "left",
                    on_interpolate = {"dateUTC": "dateUTC"},
                    expr2 = ["temperature", "humidity"])
[14]:
123
meterID
Integer
📅
dateUTC
Datetime
123
value
Numeric(10,6)
123
temperature
Numeric(10,6)
123
humidity
Numeric(11,6)
19132014-01-01 00:00:000.09738.095.0
28952014-01-01 00:00:000.18438.095.0
37952014-01-01 00:00:000.09338.095.0
47802014-01-01 00:00:000.11638.095.0
57472014-01-01 00:00:000.55938.095.0
66602014-01-01 00:00:000.83638.095.0
76402014-01-01 00:00:001.79638.095.0
86052014-01-01 00:00:000.03838.095.0
94842014-01-01 00:00:000.21138.095.0
104742014-01-01 00:00:000.31338.095.0
114572014-01-01 00:00:000.02238.095.0
123712014-01-01 00:00:000.81538.095.0
133552014-01-01 00:00:000.44838.095.0
143482014-01-01 00:00:000.07138.095.0
153072014-01-01 00:00:001.42338.095.0
161882014-01-01 00:00:000.15238.095.0
171812014-01-01 00:00:000.13838.095.0
181792014-01-01 00:00:000.03338.095.0
191292014-01-01 00:00:000.05438.095.0
201162014-01-01 00:00:000.23238.095.0
219862014-01-01 00:15:000.30138.095.0
228482014-01-01 00:15:000.18638.095.0
238292014-01-01 00:15:000.14538.095.0
247182014-01-01 00:15:000.09138.095.0
256372014-01-01 00:15:000.31938.095.0
266252014-01-01 00:15:000.14138.095.0
276192014-01-01 00:15:000.10338.095.0
285832014-01-01 00:15:004.08138.095.0
294442014-01-01 00:15:000.13138.095.0
302212014-01-01 00:15:000.39938.095.0
31672014-01-01 00:15:000.15738.095.0
32522014-01-01 00:15:000.15738.095.0
339332014-01-01 00:30:000.06137.493.0
349302014-01-01 00:30:000.20237.493.0
359042014-01-01 00:30:000.15937.493.0
368292014-01-01 00:30:000.08237.493.0
377962014-01-01 00:30:000.23737.493.0
386632014-01-01 00:30:000.0837.493.0
396282014-01-01 00:30:001.24637.493.0
406262014-01-01 00:30:000.10637.493.0
416182014-01-01 00:30:000.06737.493.0
425062014-01-01 00:30:000.10837.493.0
434972014-01-01 00:30:000.14437.493.0
444602014-01-01 00:30:000.09437.493.0
453762014-01-01 00:30:000.12937.493.0
463322014-01-01 00:30:000.04437.493.0
473082014-01-01 00:30:000.04537.493.0
482862014-01-01 00:30:000.20937.493.0
492772014-01-01 00:30:000.28737.493.0
502642014-01-01 00:30:000.16237.493.0
511382014-01-01 00:30:002.27637.493.0
52902014-01-01 00:30:000.18337.493.0
539772014-01-01 00:45:000.17637.493.0
549372014-01-01 00:45:000.20137.493.0
559272014-01-01 00:45:000.55137.493.0
568672014-01-01 00:45:000.84437.493.0
577622014-01-01 00:45:000.1337.493.0
585282014-01-01 00:45:000.06737.493.0
594472014-01-01 00:45:000.59937.493.0
603752014-01-01 00:45:000.51937.493.0
612972014-01-01 00:45:000.60937.493.0
622502014-01-01 00:45:000.42837.493.0
632352014-01-01 00:45:000.0637.493.0
649802014-01-01 01:00:000.1637.4100.0
657972014-01-01 01:00:000.11437.4100.0
667832014-01-01 01:00:000.02537.4100.0
677092014-01-01 01:00:000.05837.4100.0
686972014-01-01 01:00:000.18437.4100.0
696362014-01-01 01:00:000.13937.4100.0
705482014-01-01 01:00:000.30937.4100.0
713742014-01-01 01:00:000.10437.4100.0
723582014-01-01 01:00:000.47137.4100.0
733042014-01-01 01:00:000.10937.4100.0
742912014-01-01 01:00:000.41237.4100.0
752632014-01-01 01:00:000.17237.4100.0
762562014-01-01 01:00:000.12437.4100.0
771232014-01-01 01:00:000.30937.4100.0
78792014-01-01 01:00:000.24337.4100.0
79752014-01-01 01:00:000.27437.4100.0
80612014-01-01 01:00:000.137.4100.0
81352014-01-01 01:00:000.13437.4100.0
829502014-01-01 01:15:000.12737.4100.0
838442014-01-01 01:15:000.53937.4100.0
848322014-01-01 01:15:000.35837.4100.0
858072014-01-01 01:15:000.09537.4100.0
866562014-01-01 01:15:000.10437.4100.0
875982014-01-01 01:15:000.1837.4100.0
885882014-01-01 01:15:000.06437.4100.0
895702014-01-01 01:15:000.01837.4100.0
904762014-01-01 01:15:000.29937.4100.0
914672014-01-01 01:15:000.29237.4100.0
923862014-01-01 01:15:000.15637.4100.0
933062014-01-01 01:15:000.1637.4100.0
942902014-01-01 01:15:000.09237.4100.0
951932014-01-01 01:15:000.10137.4100.0
961342014-01-01 01:15:000.42937.4100.0
971232014-01-01 01:15:000.44637.4100.0
981192014-01-01 01:15:000.26837.4100.0
99892014-01-01 01:15:000.10737.4100.0
10022014-01-01 01:15:000.03737.4100.0
Rows: 1-100 | Columns: 5
[15]:
print(sm_consumption.join(sm_weather,
                          how = "left",
                          on_interpolate = {"dateUTC": "dateUTC"},
                          expr2 = ["temperature", "humidity"]).current_relation())
(
   SELECT
     "meterID",
     "dateUTC",
     "value",
     "temperature",
     "humidity"
   FROM
 (
   SELECT
     x.*,
     y.temperature,
     y.humidity
   FROM
 "v_temp_schema"."_verticapy_tmp_sm_consumption_dbadmin_186831_8687362587_" AS x LEFT JOIN "v_temp_schema"."_verticapy_tmp_sm_weather_dbadmin_186831_3560437028_" AS y  ON x."dateUTC" INTERPOLATE PREVIOUS VALUE y."dateUTC")
VERTICAPY_SUBTABLE)
VERTICAPY_SUBTABLE

Vertica offers powerful methods for cleaning time series data, and you can leverage it all with the flexibility of Python.