diff --git a/python/tempo/interpol.py b/python/tempo/interpol.py index eccfdb26..e5b93e2d 100644 --- a/python/tempo/interpol.py +++ b/python/tempo/interpol.py @@ -193,7 +193,10 @@ def __generate_time_series_fill( :param partition_cols: partition column names :param ts_col: timestamp column name """ - return df.withColumn("previous_timestamp", col(ts_col),).withColumn( + return df.withColumn( + "previous_timestamp", + col(ts_col), + ).withColumn( "next_timestamp", lead(df[ts_col]).over(Window.partitionBy(*partition_cols).orderBy(ts_col)), ) diff --git a/python/tempo/intervals.py b/python/tempo/intervals.py index 12f7fe66..1cf7a7a6 100644 --- a/python/tempo/intervals.py +++ b/python/tempo/intervals.py @@ -346,14 +346,12 @@ def __merge_adjacent_overlaps( """ if how == "left": - # new boundary for interval end will become the start of the next # interval new_boundary_col = self.end_ts new_boundary_val = f"_lead_1_{self.start_ts}" else: - # new boundary for interval start will become the end of the # previous interval new_boundary_col = self.start_ts @@ -386,7 +384,6 @@ def __merge_adjacent_overlaps( ) if how == "left": - for c in self.metric_columns: df = df.withColumn( c, @@ -599,7 +596,6 @@ def toDF(self, stack: bool = False) -> DataFrame: """ if stack: - n_cols = len(self.metric_columns) metric_cols_expr = ",".join( tuple(f"'{col}', {col}" for col in self.metric_columns) diff --git a/python/tempo/tsdf.py b/python/tempo/tsdf.py index 778ec3ca..bc16455b 100644 --- a/python/tempo/tsdf.py +++ b/python/tempo/tsdf.py @@ -1236,7 +1236,6 @@ def interpolate( return TSDF(interpolated_df, ts_col=ts_col, partition_cols=partition_cols) def calc_bars(tsdf, freq, func=None, metricCols=None, fill=None): - resample_open = tsdf.resample( freq=freq, func="floor", metricCols=metricCols, prefix="open", fill=fill )