Time Series Analysisbasics

Mon 30 June 2025
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.455345
2023-01-04 -0.163381
2023-01-05 -0.306777
2023-01-06 0.168787
2023-01-07 0.689750
2023-01-08 1.164823
2023-01-09 0.561895
2023-01-10 0.544220
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.402455
2023-01-04 0.001270
2023-01-05 0.500184
2023-01-06 0.666031
2023-01-07 0.601255
2023-01-08 -0.015943
2023-01-09 0.030061
2023-01-10 -0.082104
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.899961
2023-01-04 0.079906
2023-01-05 -0.614689
2023-01-06 0.622113
2023-01-07 0.200973
2023-01-08 0.856261
2023-01-09 0.109959
2023-01-10 0.020210
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.448851
2023-01-04 -0.976926
2023-01-05 -0.833225
2023-01-06 -1.006448
2023-01-07 -1.145399
2023-01-08 -1.095457
2023-01-09 -0.829080
2023-01-10 -0.046893
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.505105
2023-01-04 -0.122031
2023-01-05 -0.388545
2023-01-06 0.410296
2023-01-07 0.431501
2023-01-08 0.901595
2023-01-09 0.239899
2023-01-10 -0.223432
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.083860
2023-01-04 0.793722
2023-01-05 0.482279
2023-01-06 0.217652
2023-01-07 -0.175020
2023-01-08 -0.340376
2023-01-09 -0.347463
2023-01-10 -0.530346
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.010082
2023-01-04 0.220195
2023-01-05 0.873778
2023-01-06 1.019814
2023-01-07 0.053120
2023-01-08 -0.002058
2023-01-09 -0.229925
2023-01-10 0.311565
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.102824
2023-01-04 0.906991
2023-01-05 0.795885
2023-01-06 0.528194
2023-01-07 1.001081
2023-01-08 0.772227
2023-01-09 0.458938
2023-01-10 0.350847
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.017719
2023-01-04 -0.351434
2023-01-05 -1.007042
2023-01-06 -0.554440
2023-01-07 0.432515
2023-01-08 0.813879
2023-01-09 0.940191
2023-01-10 0.344685
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.013199
2023-01-04 -0.073481
2023-01-05 0.412134
2023-01-06 -0.224390
2023-01-07 -0.193373
2023-01-08 -1.065614
2023-01-09 -1.095660
2023-01-10 -1.140764
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.481464
2023-01-04 0.059991
2023-01-05 0.012221
2023-01-06 -0.064270
2023-01-07 -0.605293
2023-01-08 -0.076915
2023-01-09 0.072444
2023-01-10 1.055249
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.342117
2023-01-04 0.061042
2023-01-05 0.591093
2023-01-06 -0.297031
2023-01-07 -0.995933
2023-01-08 -0.342192
2023-01-09 0.172289
2023-01-10 0.856617
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.589539
2023-01-04 -0.356276
2023-01-05 -0.451450
2023-01-06 -0.187241
2023-01-07 -0.536320
2023-01-08 -0.289955
2023-01-09 -0.251856
2023-01-10 0.051579
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -1.072860
2023-01-04 -0.930916
2023-01-05 -1.033701
2023-01-06 -0.921453
2023-01-07 -1.058494
2023-01-08 -0.874826
2023-01-09 -0.729054
2023-01-10 -0.272282
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.813701
2023-01-04 -0.810985
2023-01-05 -0.848145
2023-01-06 0.110143
2023-01-07 -0.040091
2023-01-08 0.254453
2023-01-09 -0.190737
2023-01-10 0.107153
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.814854
2023-01-04 0.901178
2023-01-05 0.780190
2023-01-06 0.983484
2023-01-07 0.732861
2023-01-08 0.706328
2023-01-09 0.241912
2023-01-10 0.067061
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.707774
2023-01-04 0.662536
2023-01-05 -0.809043
2023-01-06 -0.312012
2023-01-07 -0.278850
2023-01-08 0.484439
2023-01-09 -0.019309
2023-01-10 -0.191957
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.507275
2023-01-04 0.207025
2023-01-05 0.353679
2023-01-06 -0.701729
2023-01-07 -0.699173
2023-01-08 -0.208695
2023-01-09 -0.363030
2023-01-10 -0.550154
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.211394
2023-01-04 -0.245213
2023-01-05 -0.231204
2023-01-06 -0.272467
2023-01-07 -0.155950
2023-01-08 -0.010890
2023-01-09 -0.536961
2023-01-10 -0.584466
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.401673
2023-01-04 0.085435
2023-01-05 -0.076751
2023-01-06 -0.841762
2023-01-07 -0.623008
2023-01-08 -0.942921
2023-01-09 -0.665248
2023-01-10 -0.435025
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.023341
2023-01-04 0.593240
2023-01-05 -0.195281
2023-01-06 -0.490133
2023-01-07 -0.794666
2023-01-08 0.311786
2023-01-09 0.367508
2023-01-10 0.165374
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.215975
2023-01-04 0.655326
2023-01-05 0.405062
2023-01-06 -0.063762
2023-01-07 -0.281627
2023-01-08 -0.088828
2023-01-09 0.139908
2023-01-10 0.314369
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.698106
2023-01-04 0.197327
2023-01-05 0.777726
2023-01-06 1.202514
2023-01-07 0.490491
2023-01-08 -0.323382
2023-01-09 -0.549922
2023-01-10 -0.657447
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.341768
2023-01-04 -0.061887
2023-01-05 0.372018
2023-01-06 -0.027458
2023-01-07 0.446095
2023-01-08 -0.213124
2023-01-09 0.279766
2023-01-10 -0.475471
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.603550
2023-01-04 -0.150682
2023-01-05 0.028362
2023-01-06 0.015139
2023-01-07 -0.420404
2023-01-08 0.436354
2023-01-09 -0.026366
2023-01-10 0.097097
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.120743
2023-01-04 -0.104357
2023-01-05 -0.294563
2023-01-06 -0.779888
2023-01-07 -1.092840
2023-01-08 -1.318567
2023-01-09 -0.831165
2023-01-10 0.290400
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 1.127478
2023-01-04 0.860556
2023-01-05 0.070050
2023-01-06 0.270364
2023-01-07 0.421033
2023-01-08 0.040567
2023-01-09 -0.566773
2023-01-10 -0.844156
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.511033
2023-01-04 1.006331
2023-01-05 0.797123
2023-01-06 0.716819
2023-01-07 0.064466
2023-01-08 0.750119
2023-01-09 0.612040
2023-01-10 0.718836
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.029495
2023-01-04 -0.392525
2023-01-05 -0.361904
2023-01-06 -0.164049
2023-01-07 0.138710
2023-01-08 -0.038777
2023-01-09 -0.236460
2023-01-10 -0.150957
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.867653
2023-01-04 0.104170
2023-01-05 -0.079328
2023-01-06 -0.389219
2023-01-07 -0.506333
2023-01-08 -0.964075
2023-01-09 -0.828829
2023-01-10 -1.028234
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.324976
2023-01-04 0.792374
2023-01-05 0.717894
2023-01-06 0.847115
2023-01-07 -0.098695
2023-01-08 0.020508
2023-01-09 0.415424
2023-01-10 1.172226
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -1.255621
2023-01-04 -0.550303
2023-01-05 -0.127713
2023-01-06 -0.020414
2023-01-07 -0.696512
2023-01-08 0.880131
2023-01-09 1.245384
2023-01-10 1.771658
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.076766
2023-01-04 0.429637
2023-01-05 -0.063516
2023-01-06 0.236112
2023-01-07 -0.001947
2023-01-08 0.023742
2023-01-09 0.316385
2023-01-10 -0.205092
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.016014
2023-01-04 0.171982
2023-01-05 -0.926093
2023-01-06 -1.127064
2023-01-07 -1.038746
2023-01-08 -0.965130
2023-01-09 -0.238579
2023-01-10 -0.216302
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.617640
2023-01-04 0.589801
2023-01-05 0.412427
2023-01-06 0.214879
2023-01-07 -0.131293
2023-01-08 -0.256870
2023-01-09 -0.334522
2023-01-10 -0.327717
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.060912
2023-01-04 -0.172716
2023-01-05 -0.434504
2023-01-06 -0.714644
2023-01-07 -0.469484
2023-01-08 -0.402860
2023-01-09 -0.165643
2023-01-10 0.110229
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.889194
2023-01-04 0.962296
2023-01-05 0.439898
2023-01-06 0.097016
2023-01-07 -0.701916
2023-01-08 0.135287
2023-01-09 -0.268747
2023-01-10 -0.341324
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 1.122877
2023-01-04 0.768545
2023-01-05 1.331648
2023-01-06 1.184160
2023-01-07 1.160225
2023-01-08 0.506771
2023-01-09 -0.124577
2023-01-10 -0.443260
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.468408
2023-01-04 -0.086723
2023-01-05 -0.409503
2023-01-06 -0.779904
2023-01-07 -0.629338
2023-01-08 -0.288806
2023-01-09 -0.160824
2023-01-10 0.064937
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.169324
2023-01-04 -0.625299
2023-01-05 -0.292334
2023-01-06 0.104323
2023-01-07 0.905070
2023-01-08 0.796666
2023-01-09 0.328287
2023-01-10 0.335575
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.220957
2023-01-04 -0.335426
2023-01-05 -0.331970
2023-01-06 -0.326188
2023-01-07 0.504867
2023-01-08 0.181993
2023-01-09 1.065133
2023-01-10 0.258067
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.931927
2023-01-04 -0.540880
2023-01-05 -0.956077
2023-01-06 -0.958678
2023-01-07 -0.998837
2023-01-08 -0.405979
2023-01-09 -0.190680
2023-01-10 0.881989
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.129914
2023-01-04 -0.013221
2023-01-05 0.361741
2023-01-06 -0.105830
2023-01-07 -0.687194
2023-01-08 -0.831380
2023-01-09 -0.599155
2023-01-10 0.189152
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 1.184475
2023-01-04 0.672227
2023-01-05 -0.175610
2023-01-06 -1.732273
2023-01-07 -1.269611
2023-01-08 -1.057342
2023-01-09 -0.709802
2023-01-10 -0.706753
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.749461
2023-01-04 -0.027555
2023-01-05 0.396270
2023-01-06 0.247447
2023-01-07 -0.509975
2023-01-08 -0.384418
2023-01-09 -0.573017
2023-01-10 -0.496493
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.370430
2023-01-04 0.480461
2023-01-05 0.964202
2023-01-06 1.236433
2023-01-07 0.585545
2023-01-08 0.524437
2023-01-09 0.770801
2023-01-10 1.279966
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.486559
2023-01-04 -0.315208
2023-01-05 -0.359074
2023-01-06 -0.178662
2023-01-07 0.984007
2023-01-08 1.046246
2023-01-09 0.496353
2023-01-10 -0.031026
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.226986
2023-01-04 0.504198
2023-01-05 0.413902
2023-01-06 0.692015
2023-01-07 -0.172914
2023-01-08 -0.222770
2023-01-09 -0.214817
2023-01-10 -0.210257
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.571714
2023-01-04 0.956100
2023-01-05 1.356414
2023-01-06 0.927804
2023-01-07 0.128436
2023-01-08 0.056696
2023-01-09 0.487728
2023-01-10 1.011505
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.501991
2023-01-04 -0.177344
2023-01-05 -0.104100
2023-01-06 -0.140712
2023-01-07 0.372670
2023-01-08 0.027844
2023-01-09 0.153230
2023-01-10 0.238420
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.283937
2023-01-04 -0.019113
2023-01-05 -0.281153
2023-01-06 -0.241880
2023-01-07 -0.649052
2023-01-08 0.486557
2023-01-09 0.359155
2023-01-10 0.705675
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.066424
2023-01-04 0.203665
2023-01-05 0.246943
2023-01-06 0.293614
2023-01-07 0.168777
2023-01-08 -0.001124
2023-01-09 -0.089598
2023-01-10 -0.060079
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.058485
2023-01-04 -0.097147
2023-01-05 0.241033
2023-01-06 0.581798
2023-01-07 0.484388
2023-01-08 0.403761
2023-01-09 -0.351264
2023-01-10 -0.286496
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.378837
2023-01-04 -0.818015
2023-01-05 -0.311032
2023-01-06 -0.038434
2023-01-07 0.350513
2023-01-08 0.394329
2023-01-09 0.221573
2023-01-10 0.334871
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.436111
2023-01-04 -0.769581
2023-01-05 -0.848826
2023-01-06 -0.526144
2023-01-07 -0.558130
2023-01-08 -0.279178
2023-01-09 -0.341613
2023-01-10 0.606236
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.797733
2023-01-04 0.170173
2023-01-05 0.526149
2023-01-06 0.478205
2023-01-07 0.572423
2023-01-08 1.071119
2023-01-09 0.435074
2023-01-10 0.199233
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.067164
2023-01-04 -0.419004
2023-01-05 -0.887660
2023-01-06 -0.914643
2023-01-07 -0.389626
2023-01-08 -0.059825
2023-01-09 -0.371384
2023-01-10 -0.094110
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.300930
2023-01-04 0.086051
2023-01-05 0.268919
2023-01-06 0.257376
2023-01-07 0.719108
2023-01-08 0.637391
2023-01-09 0.528254
2023-01-10 -0.253934
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.101143
2023-01-04 0.213756
2023-01-05 0.463253
2023-01-06 0.049552
2023-01-07 -0.408197
2023-01-08 -0.115535
2023-01-09 0.467059
2023-01-10 0.263123
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -1.114385
2023-01-04 -0.904886
2023-01-05 -0.574685
2023-01-06 0.405308
2023-01-07 0.255621
2023-01-08 0.292428
2023-01-09 -0.629605
2023-01-10 -0.441402
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.134436
2023-01-04 -0.027666
2023-01-05 -0.272544
2023-01-06 -0.004398
2023-01-07 -0.273488
2023-01-08 -0.069535
2023-01-09 -0.227589
2023-01-10 -0.234696
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -1.610867
2023-01-04 -1.048348
2023-01-05 -0.475476
2023-01-06 0.248439
2023-01-07 0.857446
2023-01-08 1.380015
2023-01-09 0.911190
2023-01-10 -0.199561
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.582221
2023-01-04 0.374788
2023-01-05 0.591080
2023-01-06 -0.021416
2023-01-07 0.260001
2023-01-08 0.554802
2023-01-09 0.412347
2023-01-10 -0.501018
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.030375
2023-01-04 0.267388
2023-01-05 -0.183730
2023-01-06 0.058515
2023-01-07 0.387964
2023-01-08 1.304983
2023-01-09 0.864905
2023-01-10 0.246982
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.646842
2023-01-04 -0.356523
2023-01-05 -0.589815
2023-01-06 -0.234761
2023-01-07 0.606317
2023-01-08 0.002866
2023-01-09 -0.566883
2023-01-10 -0.976871
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.202820
2023-01-04 -1.073122
2023-01-05 -0.630652
2023-01-06 -0.907455
2023-01-07 -0.591994
2023-01-08 -1.649600
2023-01-09 -1.425305
2023-01-10 -1.104728
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.415922
2023-01-04 0.480351
2023-01-05 -0.213164
2023-01-06 -0.222768
2023-01-07 -0.382319
2023-01-08 -0.592524
2023-01-09 -0.759940
2023-01-10 -0.596916
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.126880
2023-01-04 -0.195678
2023-01-05 -0.293899
2023-01-06 -0.329358
2023-01-07 0.214131
2023-01-08 -0.005472
2023-01-09 -0.175655
2023-01-10 -0.020069
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.104942
2023-01-04 -0.243313
2023-01-05 -0.218983
2023-01-06 -0.304048
2023-01-07 -0.016053
2023-01-08 -0.829299
2023-01-09 -0.806867
2023-01-10 -0.496284
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.120224
2023-01-04 0.266281
2023-01-05 0.292036
2023-01-06 0.159905
2023-01-07 -0.139391
2023-01-08 0.181078
2023-01-09 0.570614
2023-01-10 0.063435
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.532802
2023-01-04 0.527380
2023-01-05 0.582443
2023-01-06 0.003714
2023-01-07 0.015719
2023-01-08 -0.211742
2023-01-09 0.165809
2023-01-10 0.506944
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.401207
2023-01-04 -0.512625
2023-01-05 -0.223882
2023-01-06 -0.680219
2023-01-07 -0.370883
2023-01-08 -0.438501
2023-01-09 0.322293
2023-01-10 -0.296953
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.339588
2023-01-04 -0.610681
2023-01-05 -0.525021
2023-01-06 -0.549489
2023-01-07 -0.532428
2023-01-08 -0.656072
2023-01-09 -0.442848
2023-01-10 0.126679
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.512736
2023-01-04 0.888266
2023-01-05 -0.050354
2023-01-06 -0.012928
2023-01-07 -0.659232
2023-01-08 -0.510048
2023-01-09 -1.005483
2023-01-10 -0.936165
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.433583
2023-01-04 0.792257
2023-01-05 0.506155
2023-01-06 0.878339
2023-01-07 0.706814
2023-01-08 0.582394
2023-01-09 0.281476
2023-01-10 0.461342
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.558317
2023-01-04 0.075532
2023-01-05 0.268273
2023-01-06 0.544400
2023-01-07 0.294550
2023-01-08 0.589538
2023-01-09 0.293471
2023-01-10 0.766885
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.141232
2023-01-04 -0.487285
2023-01-05 -0.413201
2023-01-06 -0.491183
2023-01-07 0.236887
2023-01-08 0.077676
2023-01-09 0.040283
2023-01-10 0.294769
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.985650
2023-01-04 0.683876
2023-01-05 -0.046205
2023-01-06 -0.003317
2023-01-07 -0.084904
2023-01-08 0.044604
2023-01-09 -0.155584
2023-01-10 -0.521945
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.654648
2023-01-04 -0.134653
2023-01-05 -0.467529
2023-01-06 -0.375553
2023-01-07 -0.816602
2023-01-08 -0.378400
2023-01-09 0.510663
2023-01-10 0.327654
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.147124
2023-01-04 -0.201465
2023-01-05 0.587111
2023-01-06 -0.000935
2023-01-07 -0.259204
2023-01-08 -0.554145
2023-01-09 -0.666738
2023-01-10 -0.712376
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.745820
2023-01-04 -0.238319
2023-01-05 0.229252
2023-01-06 0.202335
2023-01-07 -0.091536
2023-01-08 -0.336329
2023-01-09 -0.014810
2023-01-10 0.173246
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.546037
2023-01-04 0.272624
2023-01-05 -0.800859
2023-01-06 -0.856195
2023-01-07 -0.671862
2023-01-08 -0.620309
2023-01-09 -0.987121
2023-01-10 -0.862656
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.704583
2023-01-04 1.101888
2023-01-05 1.116637
2023-01-06 0.925777
2023-01-07 0.161418
2023-01-08 -0.518703
2023-01-09 -0.513563
2023-01-10 -0.797520
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.046132
2023-01-04 0.432483
2023-01-05 0.646260
2023-01-06 0.817102
2023-01-07 0.697185
2023-01-08 0.553752
2023-01-09 0.512009
2023-01-10 0.261162
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.138319
2023-01-04 0.000927
2023-01-05 0.535187
2023-01-06 -0.242753
2023-01-07 0.250688
2023-01-08 -0.617608
2023-01-09 -0.039421
2023-01-10 -0.430437
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.303397
2023-01-04 0.469538
2023-01-05 0.041636
2023-01-06 0.637604
2023-01-07 0.352207
2023-01-08 0.418492
2023-01-09 0.101066
2023-01-10 0.359604
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.099308
2023-01-04 0.522281
2023-01-05 0.563832
2023-01-06 0.001320
2023-01-07 0.331830
2023-01-08 0.058759
2023-01-09 0.244914
2023-01-10 -0.813847
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.326351
2023-01-04 0.051144
2023-01-05 0.614782
2023-01-06 0.699296
2023-01-07 0.523722
2023-01-08 -0.397622
2023-01-09 -0.554841
2023-01-10 -0.528872
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.135202
2023-01-04 0.088438
2023-01-05 -0.212928
2023-01-06 -0.806488
2023-01-07 -0.180999
2023-01-08 0.007500
2023-01-09 0.494235
2023-01-10 0.420073
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.583546
2023-01-04 0.744659
2023-01-05 0.636913
2023-01-06 0.400781
2023-01-07 -0.121813
2023-01-08 0.036643
2023-01-09 0.889329
2023-01-10 1.304443
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.260725
2023-01-04 0.297989
2023-01-05 0.659348
2023-01-06 0.339316
2023-01-07 -0.059587
2023-01-08 0.064990
2023-01-09 0.235433
2023-01-10 0.142407
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.493000
2023-01-04 0.703067
2023-01-05 0.690350
2023-01-06 0.723113
2023-01-07 -0.774348
2023-01-08 -0.881685
2023-01-09 -1.119207
2023-01-10 -0.110548
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -1.612276
2023-01-04 -0.921852
2023-01-05 -0.835669
2023-01-06 -1.426976
2023-01-07 -1.850759
2023-01-08 -0.633430
2023-01-09 0.074075
2023-01-10 0.316132
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.269394
2023-01-04 -0.299846
2023-01-05 0.270143
2023-01-06 0.151301
2023-01-07 0.587234
2023-01-08 0.293593
2023-01-09 -0.043310
2023-01-10 -0.448451
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.072609
2023-01-04 0.164583
2023-01-05 -0.206294
2023-01-06 0.150925
2023-01-07 -0.348694
2023-01-08 0.127242
2023-01-09 0.224922
2023-01-10 0.372208
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.055877
2023-01-04 -1.137456
2023-01-05 -0.520142
2023-01-06 -0.709258
2023-01-07 0.356650
2023-01-08 0.651046
2023-01-09 0.053049
2023-01-10 -0.270969
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.068049
2023-01-04 -0.204957
2023-01-05 -0.692901
2023-01-06 -0.650863
2023-01-07 -0.661791
2023-01-08 0.364537
2023-01-09 0.853307
2023-01-10 0.559224
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.241123
2023-01-04 0.669134
2023-01-05 0.318362
2023-01-06 0.220104
2023-01-07 -0.516816
2023-01-08 -0.407526
2023-01-09 -0.514186
2023-01-10 -0.091986
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.010403
2023-01-04 -0.184859
2023-01-05 0.013134
2023-01-06 0.302571
2023-01-07 0.245625
2023-01-08 -0.410193
2023-01-09 -0.360840
2023-01-10 -0.869657
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.227587
2023-01-04 0.577241
2023-01-05 0.105369
2023-01-06 -0.063355
2023-01-07 -0.451225
2023-01-08 -0.077175
2023-01-09 -0.415658
2023-01-10 -0.133982
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.827663
2023-01-04 -0.332915
2023-01-05 -0.168378
2023-01-06 -0.013022
2023-01-07 -0.251757
2023-01-08 0.301443
2023-01-09 0.623432
2023-01-10 1.264532
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.235776
2023-01-04 0.203603
2023-01-05 -0.163674
2023-01-06 -0.795903
2023-01-07 -0.165685
2023-01-08 0.209210
2023-01-09 0.519017
2023-01-10 0.385270
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.391188
2023-01-04 0.048226
2023-01-05 0.646386
2023-01-06 -0.258191
2023-01-07 -0.359915
2023-01-08 -0.431606
2023-01-09 -0.176984
2023-01-10 0.245705
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.197709
2023-01-04 -0.335769
2023-01-05 -0.632891
2023-01-06 -0.423709
2023-01-07 -0.257928
2023-01-08 -0.109233
2023-01-09 -0.077447
2023-01-10 -0.275011
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.307813
2023-01-04 -0.434811
2023-01-05 -0.381929
2023-01-06 -0.807948
2023-01-07 -1.371196
2023-01-08 -1.820017
2023-01-09 -1.463153
2023-01-10 -0.861100
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.097403
2023-01-04 0.089192
2023-01-05 0.254633
2023-01-06 -0.189367
2023-01-07 -0.046906
2023-01-08 -0.072243
2023-01-09 -0.290940
2023-01-10 -0.765354
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.033850
2023-01-04 -0.287465
2023-01-05 0.000446
2023-01-06 0.158375
2023-01-07 0.666035
2023-01-08 -0.042908
2023-01-09 0.009786
2023-01-10 -0.545363
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 1.146758
2023-01-04 0.591519
2023-01-05 -0.137787
2023-01-06 -1.546540
2023-01-07 -1.132671
2023-01-08 -0.728461
2023-01-09 0.349061
2023-01-10 -0.104302
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.489582
2023-01-04 0.471024
2023-01-05 1.105642
2023-01-06 0.597977
2023-01-07 0.175113
2023-01-08 -0.155421
2023-01-09 0.123730
2023-01-10 0.425730
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.369535
2023-01-04 -0.545041
2023-01-05 -0.800068
2023-01-06 -0.809425
2023-01-07 -0.631431
2023-01-08 -0.407850
2023-01-09 -0.260406
2023-01-10 0.308223
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.183659
2023-01-04 -0.119652
2023-01-05 -0.266598
2023-01-06 -0.839058
2023-01-07 -0.355040
2023-01-08 0.573541
2023-01-09 0.439808
2023-01-10 0.074707
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.483255
2023-01-04 -0.890570
2023-01-05 -0.325387
2023-01-06 0.294872
2023-01-07 0.586812
2023-01-08 0.096617
2023-01-09 0.139114
2023-01-10 -0.596817
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.363461
2023-01-04 0.933810
2023-01-05 -0.136836
2023-01-06 -0.427018
2023-01-07 -1.036642
2023-01-08 -1.094978
2023-01-09 -0.271558
2023-01-10 -0.227785
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.565084
2023-01-04 -0.401098
2023-01-05 0.366443
2023-01-06 0.097784
2023-01-07 -0.084587
2023-01-08 -0.536190
2023-01-09 0.002674
2023-01-10 -0.284731
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.229994
2023-01-04 0.449233
2023-01-05 -0.084476
2023-01-06 -0.070399
2023-01-07 -0.542838
2023-01-08 -0.800218
2023-01-09 -1.191586
2023-01-10 -0.980551
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.272661
2023-01-04 -0.123523
2023-01-05 -0.228095
2023-01-06 -0.491768
2023-01-07 -0.197100
2023-01-08 0.081166
2023-01-09 -0.012130
2023-01-10 0.143853
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.404596
2023-01-04 -0.224932
2023-01-05 -0.250394
2023-01-06 -0.455426
2023-01-07 -0.664473
2023-01-08 -0.931310
2023-01-09 -1.413107
2023-01-10 -1.135399
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.623948
2023-01-04 -0.470427
2023-01-05 -0.136939
2023-01-06 0.829972
2023-01-07 0.058540
2023-01-08 -0.027514
2023-01-09 -0.081985
2023-01-10 0.150239
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.369107
2023-01-04 0.560506
2023-01-05 -0.321748
2023-01-06 -0.552387
2023-01-07 -0.314746
2023-01-08 -0.243086
2023-01-09 0.012839
2023-01-10 0.118713
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.541198
2023-01-04 0.089901
2023-01-05 -0.334090
2023-01-06 -0.385323
2023-01-07 0.061620
2023-01-08 0.197957
2023-01-09 -0.642131
2023-01-10 -0.706187
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.455448
2023-01-04 0.908308
2023-01-05 0.822342
2023-01-06 0.976044
2023-01-07 1.257226
2023-01-08 0.604898
2023-01-09 0.243576
2023-01-10 -0.072402
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.570896
2023-01-04 0.464861
2023-01-05 -0.451654
2023-01-06 -0.756106
2023-01-07 -0.852941
2023-01-08 -0.624085
2023-01-09 -0.619821
2023-01-10 -0.652955
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.379312
2023-01-04 -0.917941
2023-01-05 -0.821152
2023-01-06 -1.138969
2023-01-07 0.000504
2023-01-08 0.032043
2023-01-09 0.154384
2023-01-10 -0.241546
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.012934
2023-01-04 0.439128
2023-01-05 0.394586
2023-01-06 0.554015
2023-01-07 0.532732
2023-01-08 0.784559
2023-01-09 0.533355
2023-01-10 0.356181
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.316240
2023-01-04 -0.853967
2023-01-05 -0.447950
2023-01-06 -0.315779
2023-01-07 -0.323273
2023-01-08 -0.550318
2023-01-09 -0.421425
2023-01-10 -0.726292
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.428800
2023-01-04 0.688354
2023-01-05 0.420143
2023-01-06 0.921137
2023-01-07 -0.194677
2023-01-08 0.239369
2023-01-09 -0.398747
2023-01-10 -0.173778
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.423789
2023-01-04 -0.672689
2023-01-05 -0.440503
2023-01-06 -0.771668
2023-01-07 -0.506637
2023-01-08 0.049220
2023-01-09 0.609881
2023-01-10 0.532720
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.051869
2023-01-04 0.542503
2023-01-05 0.913459
2023-01-06 1.120806
2023-01-07 0.915087
2023-01-08 0.708357
2023-01-09 -0.065681
2023-01-10 -0.556563
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.247284
2023-01-04 -0.200941
2023-01-05 0.049446
2023-01-06 0.111223
2023-01-07 0.357921
2023-01-08 -0.338011
2023-01-09 -0.635472
2023-01-10 -0.958967
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.359781
2023-01-04 0.167589
2023-01-05 -0.102978
2023-01-06 -0.654832
2023-01-07 -0.389083
2023-01-08 -0.143092
2023-01-09 -0.205954
2023-01-10 -0.428056
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.370280
2023-01-04 0.481394
2023-01-05 0.106396
2023-01-06 0.273393
2023-01-07 -0.776936
2023-01-08 -0.135672
2023-01-09 -0.582935
2023-01-10 0.214053
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.058641
2023-01-04 -0.660589
2023-01-05 -0.106876
2023-01-06 0.123809
2023-01-07 1.472027
2023-01-08 1.041045
2023-01-09 0.440032
2023-01-10 -0.958953
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.805561
2023-01-04 -0.880996
2023-01-05 -0.963040
2023-01-06 -0.726059
2023-01-07 -1.526570
2023-01-08 -1.267852
2023-01-09 -0.755761
2023-01-10 0.452397
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.202842
2023-01-04 -0.150494
2023-01-05 0.322694
2023-01-06 0.228173
2023-01-07 -0.305958
2023-01-08 -0.936114
2023-01-09 -0.368715
2023-01-10 0.142515
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.296635
2023-01-04 -0.993193
2023-01-05 -0.399082
2023-01-06 0.152050
2023-01-07 0.404973
2023-01-08 0.479680
2023-01-09 -0.280209
2023-01-10 0.219804
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.559069
2023-01-04 -0.162447
2023-01-05 -0.243295
2023-01-06 -0.257820
2023-01-07 -0.213019
2023-01-08 0.266281
2023-01-09 0.744930
2023-01-10 1.008320
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -1.025235
2023-01-04 -1.289819
2023-01-05 -0.379340
2023-01-06 -0.267912
2023-01-07 -0.113072
2023-01-08 -0.396749
2023-01-09 -0.841764
2023-01-10 -0.701255
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 1.042054
2023-01-04 1.339234
2023-01-05 1.377624
2023-01-06 1.535001
2023-01-07 1.079872
2023-01-08 0.338095
2023-01-09 -0.594645
2023-01-10 -0.391941
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.153975
2023-01-04 0.021615
2023-01-05 0.832148
2023-01-06 0.017946
2023-01-07 -0.213805
2023-01-08 -0.557507
2023-01-09 -0.859813
2023-01-10 -0.637174
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.066284
2023-01-04 0.340306
2023-01-05 1.227561
2023-01-06 1.179159
2023-01-07 1.198017
2023-01-08 -0.148784
2023-01-09 0.278712
2023-01-10 -0.046667
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.487963
2023-01-04 0.128652
2023-01-05 -0.546572
2023-01-06 -0.931533
2023-01-07 -1.030245
2023-01-08 -0.662141
2023-01-09 0.369202
2023-01-10 1.405673
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.520899
2023-01-04 0.194174
2023-01-05 0.485593
2023-01-06 0.460869
2023-01-07 0.078063
2023-01-08 0.116637
2023-01-09 -0.057558
2023-01-10 0.754374
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.247683
2023-01-04 0.383692
2023-01-05 -0.261938
2023-01-06 0.271301
2023-01-07 0.197454
2023-01-08 0.631162
2023-01-09 0.495746
2023-01-10 0.454159
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.211562
2023-01-04 0.393843
2023-01-05 -0.432299
2023-01-06 -0.264888
2023-01-07 -0.790859
2023-01-08 0.075019
2023-01-09 0.489868
2023-01-10 0.997044
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.210471
2023-01-04 -0.451907
2023-01-05 -0.476627
2023-01-06 -0.575007
2023-01-07 -0.221643
2023-01-08 0.209576
2023-01-09 0.432273
2023-01-10 0.634620
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.201221
2023-01-04 -0.091083
2023-01-05 -0.000771
2023-01-06 0.354604
2023-01-07 0.588211
2023-01-08 0.903359
2023-01-09 0.781414
2023-01-10 0.142398
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.423916
2023-01-04 0.235073
2023-01-05 0.005337
2023-01-06 -0.415547
2023-01-07 -0.723591
2023-01-08 -0.218722
2023-01-09 -0.263410
2023-01-10 -0.405857
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.970210
2023-01-04 0.747069
2023-01-05 0.390360
2023-01-06 -0.158094
2023-01-07 0.208571
2023-01-08 0.682224
2023-01-09 1.075258
2023-01-10 0.527747
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.365640
2023-01-04 -0.509748
2023-01-05 -0.469951
2023-01-06 0.132518
2023-01-07 -0.132354
2023-01-08 -0.326957
2023-01-09 0.022739
2023-01-10 -0.804692
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.630281
2023-01-04 -1.101716
2023-01-05 -0.890430
2023-01-06 -0.210775
2023-01-07 0.223719
2023-01-08 0.882527
2023-01-09 0.240407
2023-01-10 0.552824
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.480310
2023-01-04 -0.788081
2023-01-05 -0.886506
2023-01-06 -0.158388
2023-01-07 -0.263106
2023-01-08 -0.722937
2023-01-09 -0.942612
2023-01-10 -0.383462
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.835568
2023-01-04 -0.371852
2023-01-05 -0.054314
2023-01-06 0.410700
2023-01-07 0.547225
2023-01-08 0.686826
2023-01-09 0.904469
2023-01-10 0.524506
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.521440
2023-01-04 -0.377617
2023-01-05 -0.164561
2023-01-06 0.201039
2023-01-07 0.571393
2023-01-08 0.446819
2023-01-09 0.828393
2023-01-10 0.143347
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.719045
2023-01-04 -0.565321
2023-01-05 -0.237902
2023-01-06 0.138528
2023-01-07 -0.043587
2023-01-08 -0.730611
2023-01-09 -1.432142
2023-01-10 -1.502665
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.578951
2023-01-04 0.397546
2023-01-05 0.930672
2023-01-06 0.151198
2023-01-07 0.363619
2023-01-08 0.083409
2023-01-09 0.450078
2023-01-10 0.137171
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.092505
2023-01-04 0.455492
2023-01-05 0.573058
2023-01-06 0.237825
2023-01-07 -0.486967
2023-01-08 -1.036851
2023-01-09 -0.821136
2023-01-10 -0.239722
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.048061
2023-01-04 0.025597
2023-01-05 0.130717
2023-01-06 0.074941
2023-01-07 0.199306
2023-01-08 0.058113
2023-01-09 -0.505475
2023-01-10 -0.573455
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.485720
2023-01-04 -1.293306
2023-01-05 -1.307850
2023-01-06 -0.558696
2023-01-07 0.174659
2023-01-08 0.508805
2023-01-09 0.737557
2023-01-10 0.483961
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.533572
2023-01-04 1.159530
2023-01-05 1.903672
2023-01-06 1.178035
2023-01-07 0.472457
2023-01-08 -0.110938
2023-01-09 0.020089
2023-01-10 0.796628
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.148146
2023-01-04 0.141417
2023-01-05 0.623128
2023-01-06 0.312488
2023-01-07 -0.021038
2023-01-08 -0.379884
2023-01-09 -0.208589
2023-01-10 -0.113431
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.399650
2023-01-04 -0.253899
2023-01-05 -0.362225
2023-01-06 0.103722
2023-01-07 0.171926
2023-01-08 0.614449
2023-01-09 0.155761
2023-01-10 -0.122357
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.448234
2023-01-04 0.611672
2023-01-05 0.362814
2023-01-06 0.187213
2023-01-07 -0.581487
2023-01-08 -0.532864
2023-01-09 -0.308371
2023-01-10 0.431991
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.912384
2023-01-04 -0.376025
2023-01-05 -0.208905
2023-01-06 0.649539
2023-01-07 0.220801
2023-01-08 0.353801
2023-01-09 -0.097418
2023-01-10 0.031999
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.611788
2023-01-04 0.354494
2023-01-05 0.130820
2023-01-06 0.445980
2023-01-07 0.016074
2023-01-08 0.302467
2023-01-09 -0.050303
2023-01-10 0.188200
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.389865
2023-01-04 0.046616
2023-01-05 -0.653472
2023-01-06 0.052290
2023-01-07 -0.630065
2023-01-08 -0.388018
2023-01-09 0.027877
2023-01-10 0.438080
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.445034
2023-01-04 0.238360
2023-01-05 0.182640
2023-01-06 -0.023348
2023-01-07 -1.131669
2023-01-08 -0.729122
2023-01-09 -1.285561
2023-01-10 -1.294591
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 1.358068
2023-01-04 -0.234021
2023-01-05 -0.034493
2023-01-06 0.282133
2023-01-07 1.035111
2023-01-08 0.965076
2023-01-09 0.903509
2023-01-10 1.471558
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.078324
2023-01-04 -0.092938
2023-01-05 -0.001258
2023-01-06 0.850358
2023-01-07 0.648864
2023-01-08 0.124194
2023-01-09 -0.003931
2023-01-10 -0.857921
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.147758
2023-01-04 0.751920
2023-01-05 0.323247
2023-01-06 0.393485
2023-01-07 0.244269
2023-01-08 0.487670
2023-01-09 0.350086
2023-01-10 0.231998
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.104536
2023-01-04 0.506101
2023-01-05 0.645572
2023-01-06 0.718213
2023-01-07 0.307541
2023-01-08 0.188036
2023-01-09 -0.115730
2023-01-10 0.032886
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -1.343321
2023-01-04 -0.522433
2023-01-05 1.017902
2023-01-06 0.976013
2023-01-07 0.422286
2023-01-08 -0.202736
2023-01-09 -0.015175
2023-01-10 0.022672
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.036077
2023-01-04 0.152943
2023-01-05 0.876135
2023-01-06 0.237968
2023-01-07 0.122802
2023-01-08 -0.778276
2023-01-09 -1.606364
2023-01-10 -1.621935
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.001610
2023-01-04 0.542180
2023-01-05 0.624347
2023-01-06 0.704234
2023-01-07 0.750091
2023-01-08 0.089142
2023-01-09 -0.399897
2023-01-10 -0.842921
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -1.005868
2023-01-04 -0.114212
2023-01-05 0.230123
2023-01-06 0.680361
2023-01-07 0.269371
2023-01-08 0.287218
2023-01-09 0.580000
2023-01-10 0.135145
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.571494
2023-01-04 0.023560
2023-01-05 0.155882
2023-01-06 0.172446
2023-01-07 0.269263
2023-01-08 -0.214387
2023-01-09 -0.056708
2023-01-10 -0.540265
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.335836
2023-01-04 -0.338232
2023-01-05 -0.150512
2023-01-06 0.062376
2023-01-07 0.108221
2023-01-08 -0.265490
2023-01-09 -0.535777
2023-01-10 -0.390527
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.313017
2023-01-04 -0.244963
2023-01-05 -0.110323
2023-01-06 0.290386
2023-01-07 0.970517
2023-01-08 1.024513
2023-01-09 1.223266
2023-01-10 0.048274
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.021768
2023-01-04 0.203249
2023-01-05 0.277334
2023-01-06 0.101015
2023-01-07 -0.479227
2023-01-08 -0.780095
2023-01-09 -0.667551
2023-01-10 -0.143559
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 1.063601
2023-01-04 0.647385
2023-01-05 0.442010
2023-01-06 0.380654
2023-01-07 0.371754
2023-01-08 0.175125
2023-01-09 -0.047337
2023-01-10 -0.272813
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.411035
2023-01-04 -0.896340
2023-01-05 -0.907279
2023-01-06 -1.028834
2023-01-07 -0.596290
2023-01-08 -0.541959
2023-01-09 -0.324523
2023-01-10 -0.155162
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.891503
2023-01-04 0.517398
2023-01-05 0.396161
2023-01-06 0.757684
2023-01-07 0.437260
2023-01-08 0.790908
2023-01-09 1.244624
2023-01-10 0.538919
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.019007
2023-01-04 -0.116074
2023-01-05 0.078428
2023-01-06 0.614310
2023-01-07 0.033174
2023-01-08 -0.421501
2023-01-09 -1.442976
2023-01-10 -0.464428
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.519881
2023-01-04 0.539748
2023-01-05 -0.011987
2023-01-06 -0.301042
2023-01-07 -0.082847
2023-01-08 0.337910
2023-01-09 0.223405
2023-01-10 -0.370213
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.619276
2023-01-04 -0.771621
2023-01-05 -0.376052
2023-01-06 0.194218
2023-01-07 0.771545
2023-01-08 1.019696
2023-01-09 0.689676
2023-01-10 -0.207914
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.602635
2023-01-04 0.906536
2023-01-05 0.965196
2023-01-06 0.691066
2023-01-07 0.509557
2023-01-08 0.048667
2023-01-09 -1.145670
2023-01-10 -1.178171
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.243407
2023-01-04 0.600342
2023-01-05 0.617498
2023-01-06 0.118732
2023-01-07 0.405813
2023-01-08 0.108158
2023-01-09 0.284491
2023-01-10 -0.602624
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.922694
2023-01-04 -0.122531
2023-01-05 0.231432
2023-01-06 -0.738356
2023-01-07 -1.507553
2023-01-08 -1.106339
2023-01-09 0.053723
2023-01-10 0.637436
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.679071
2023-01-04 1.315491
2023-01-05 0.755491
2023-01-06 0.381330
2023-01-07 -0.400650
2023-01-08 0.010114
2023-01-09 -0.142561
2023-01-10 0.407329
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.143202
2023-01-04 0.208104
2023-01-05 -0.227629
2023-01-06 -0.629356
2023-01-07 -1.170754
2023-01-08 -1.245489
2023-01-09 -1.424537
2023-01-10 -0.772381
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.295168
2023-01-04 0.202005
2023-01-05 0.135366
2023-01-06 -0.478274
2023-01-07 -0.507533
2023-01-08 -0.147489
2023-01-09 0.503332
2023-01-10 0.293669
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.565530
2023-01-04 -0.308642
2023-01-05 0.389267
2023-01-06 0.850026
2023-01-07 0.447985
2023-01-08 0.393063
2023-01-09 0.153449
2023-01-10 0.045863
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.732918
2023-01-04 -0.597687
2023-01-05 0.357321
2023-01-06 0.627524
2023-01-07 0.213489
2023-01-08 -0.466244
2023-01-09 -0.733401
2023-01-10 -0.193267
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.310122
2023-01-04 -0.408376
2023-01-05 -1.052861
2023-01-06 -0.623900
2023-01-07 -0.432326
2023-01-08 -0.183999
2023-01-09 0.376699
2023-01-10 0.479068
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.452365
2023-01-04 -0.243421
2023-01-05 -0.100982
2023-01-06 -0.907891
2023-01-07 -0.345717
2023-01-08 -0.387809
2023-01-09 0.131190
2023-01-10 -0.033567
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -1.506276
2023-01-04 -0.498841
2023-01-05 -0.178505
2023-01-06 -0.063059
2023-01-07 -0.806469
2023-01-08 -0.683483
2023-01-09 -0.400796
2023-01-10 0.060494
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.517591
2023-01-04 -0.655006
2023-01-05 0.056456
2023-01-06 0.480070
2023-01-07 0.335149
2023-01-08 0.463081
2023-01-09 0.190150
2023-01-10 0.673476
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.750144
2023-01-04 -0.948654
2023-01-05 -0.568036
2023-01-06 -0.006688
2023-01-07 0.546198
2023-01-08 0.311679
2023-01-09 0.857501
2023-01-10 1.027786
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.347982
2023-01-04 -0.246175
2023-01-05 -0.462607
2023-01-06 -0.200484
2023-01-07 -0.012464
2023-01-08 0.540844
2023-01-09 0.278513
2023-01-10 0.375615
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 -0.944818
2023-01-04 -1.258446
2023-01-05 -0.319060
2023-01-06 -0.807838
2023-01-07 -0.244823
2023-01-08 -0.203143
2023-01-09 0.740145
2023-01-10 0.987105
import pandas as pd
import numpy as np
rng = pd.date_range('2023-01-01', periods=10, freq='D')
df = pd.DataFrame({'date': rng, 'value': np.random.randn(10)})
df.set_index('date').rolling(window=3).mean()
value
date
2023-01-01 NaN
2023-01-02 NaN
2023-01-03 0.058596
2023-01-04 -0.582462
2023-01-05 -0.755552
2023-01-06 0.256950
2023-01-07 0.361268
2023-01-08 0.693772
2023-01-09 -0.866219
2023-01-10 -0.814639

Score: 200

Category: pandas-work