MCPcopy Create free account
hub / github.com/dask/dask / overlap_chunk

Function overlap_chunk

dask/dataframe/rolling.py:8–32  ·  view source on GitHub ↗
(func, before, after, *args, **kwargs)

Source from the content-addressed store, hash-verified

6
7
8def overlap_chunk(func, before, after, *args, **kwargs):
9 dfs = [df for df in args if isinstance(df, CombinedOutput)]
10 combined, prev_part_length, next_part_length = dfs[0]
11
12 args = [arg[0] if isinstance(arg, CombinedOutput) else arg for arg in args]
13
14 out = func(*args, **kwargs)
15
16 if prev_part_length is None:
17 before = None
18 if isinstance(before, datetime.timedelta):
19 before = prev_part_length
20
21 expansion = None
22 if combined.shape[0] != 0:
23 expansion = out.shape[0] // combined.shape[0]
24 if before and expansion:
25 before *= expansion
26 if next_part_length is None:
27 return out.iloc[before:]
28 if isinstance(after, datetime.timedelta):
29 after = next_part_length
30 if after and expansion:
31 after *= expansion
32 return out.iloc[before:-after]
33
34
35def _head_timedelta(current, next_, after):

Callers 1

_overlap_chunkFunction · 0.90

Calls 1

funcFunction · 0.70

Tested by

no test coverage detected