bottleneck icon indicating copy to clipboard operation
bottleneck copied to clipboard

use move_mean and set window&min_count =1, diff result

Open gucasbrg opened this issue 9 months ago • 0 comments

import bottleneck as bn
a = [0.008196721311475436, -0.01626016260162607, 0.012396694214876205, -0.016326530612245076, 0.008298755186722151, 0.004115226337448442, 0.0, -0.008196721311475436, -0.008264462809917252, -0.00416666666666668, -0.012552301255230165, -0.012711864406779568, 0.017167381974248982, 0.008438818565400736, 0.004184100418410055, -0.00833333333333336, 0.008403361344537843, -0.01666666666666672, 0.0, 0.016949152542372937, -0.00416666666666668, 0.0, 0.004184100418410055, -0.012499999999999907, -0.004219409282700569, 0.004237288135593369, -0.004219409282700569, -0.025423728813559268, -0.02173913043478254, 0.013333333333333234, 0.0, 0.039473684210526445, 0.05063291139240508, 0.012048192771084246, -0.007936507936507962, -0.003999999999999886, -0.00803212851405625, 0.01619433198380546, -0.01593625498007948, 0.0, -0.016194331983805717, 0.008230452674897144, 0.008163265306122474, -0.012145748987854418, -0.012295081967213154, -0.024896265560165793, -0.012765957446808685, 0.004310344827586358, -0.008583690987124627, 0.0, 0.05194805194805212, 0.008230452674897144, -0.016326530612245076, -0.008298755186721888, 0.0, -0.01673640167364009, 0.02127659574468078, -0.012499999999999907, 0.0, -0.004219409282700569, 0.004237288135593369, -0.012658227848101439, 0.004273504273504423, 0.008510638297872367, -0.00843881856540087, -0.012765957446808685, 0.0, -0.008620689655172306, 0.017391304347826004, -0.004273504273504152, 0.008583690987124491, 0.004255319148936049, 0.004237288135593369, 0.0, 0.004219409282700301, 0.004201680672268921, -0.004184100418410055, 0.008403361344537843, -0.020833333333333266, -0.012765957446808685, 0.004310344827586358, 0.008583690987124491, -0.008510638297872367, 0.0042918454935621094, -0.004273504273504152, -0.004291845493562381, 0.004310344827586358, -0.004291845493562381, 0.017241379310344883, 0.012711864406779702, -0.008368200836819977, 0.021097046413501908, 0.012396694214876205, 0.012244897959183583, 0.0, 0.0, -0.008064516129032284, -0.004065040650406388, -0.012244897959183841, -0.004132231404958691, 0.008298755186722151, -0.01646090534979429, 0.004184100418410055, 0.004166666666666548, 0.0, 0.008298755186722151, 0.041152263374485465, -0.02371541501976267, -0.016194331983805717, -0.024691358024691305, -0.02109704641350231, 0.0, 0.0129310344827588, 0.017021276595744598, -0.012552301255230165, 0.0, 0.012711864406779702, 0.03347280334728044, 0.0]
b = bn.move_mean(a, window=1, min_count=1)
for item1, item2 in zip(a[-60:], b[-60:]):
    print(item1, item2)

gucasbrg avatar Sep 06 '23 02:09 gucasbrg