`.tsp._anal`: add (unused) `detect_vlm_gaps()`
parent
c390e87536
commit
d7179d47b0
|
@ -616,6 +616,18 @@ def detect_price_gaps(
|
||||||
# ])
|
# ])
|
||||||
...
|
...
|
||||||
|
|
||||||
|
# TODO: probably just use the null_segs impl above?
|
||||||
|
def detect_vlm_gaps(
|
||||||
|
df: pl.DataFrame,
|
||||||
|
col: str = 'volume',
|
||||||
|
|
||||||
|
) -> pl.DataFrame:
|
||||||
|
|
||||||
|
vnull: pl.DataFrame = w_dts.filter(
|
||||||
|
pl.col(col) == 0
|
||||||
|
)
|
||||||
|
return vnull
|
||||||
|
|
||||||
|
|
||||||
def dedupe(
|
def dedupe(
|
||||||
src_df: pl.DataFrame,
|
src_df: pl.DataFrame,
|
||||||
|
@ -626,7 +638,6 @@ def dedupe(
|
||||||
|
|
||||||
) -> tuple[
|
) -> tuple[
|
||||||
pl.DataFrame, # with dts
|
pl.DataFrame, # with dts
|
||||||
pl.DataFrame, # gaps
|
|
||||||
pl.DataFrame, # with deduplicated dts (aka gap/repeat removal)
|
pl.DataFrame, # with deduplicated dts (aka gap/repeat removal)
|
||||||
int, # len diff between input and deduped
|
int, # len diff between input and deduped
|
||||||
]:
|
]:
|
||||||
|
@ -639,19 +650,22 @@ def dedupe(
|
||||||
'''
|
'''
|
||||||
wdts: pl.DataFrame = with_dts(src_df)
|
wdts: pl.DataFrame = with_dts(src_df)
|
||||||
|
|
||||||
# maybe sort on any time field
|
deduped = wdts
|
||||||
if sort:
|
|
||||||
wdts = wdts.sort(by='time')
|
|
||||||
# TODO: detect out-of-order segments which were corrected!
|
|
||||||
# -[ ] report in log msg
|
|
||||||
# -[ ] possibly return segment sections which were moved?
|
|
||||||
|
|
||||||
# remove duplicated datetime samples/sections
|
# remove duplicated datetime samples/sections
|
||||||
deduped: pl.DataFrame = wdts.unique(
|
deduped: pl.DataFrame = wdts.unique(
|
||||||
subset=['dt'],
|
# subset=['dt'],
|
||||||
|
subset=['time'],
|
||||||
maintain_order=True,
|
maintain_order=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# maybe sort on any time field
|
||||||
|
if sort:
|
||||||
|
deduped = deduped.sort(by='time')
|
||||||
|
# TODO: detect out-of-order segments which were corrected!
|
||||||
|
# -[ ] report in log msg
|
||||||
|
# -[ ] possibly return segment sections which were moved?
|
||||||
|
|
||||||
diff: int = (
|
diff: int = (
|
||||||
wdts.height
|
wdts.height
|
||||||
-
|
-
|
||||||
|
|
Loading…
Reference in New Issue