Python Forum
Newbie question on how to use pandas.rolling_mean
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Newbie question on how to use pandas.rolling_mean
#5
from numpy import *
import numpy as np
import pandas as pd

data = [1.0, 2.0, 3.0, 4.0]
s1 = pd.Series(data)
rollmean = pd.Series.rolling(s1, 2).mean()
#print(rollmean)
filled0 = [0.0 if isnan(item) else item for item in rollmean]
print(filled0)
Great, I have figured it out with the above code.
Thanks,
Reply


Messages In This Thread
RE: Newbie question on how to use pandas.rolling_mean - by zydjohn - Dec-09-2017, 08:38 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  pandas df inside a df question mbaker_wv 4 1,251 Dec-25-2022, 01:11 AM
Last Post: mbaker_wv
  Pandas usecols question rsearing 1 1,302 Aug-20-2022, 10:10 PM
Last Post: jefsummers
  Simple pandas question mcva 4 2,728 Dec-17-2021, 04:47 PM
Last Post: mcva
  Pandas question new2datasci 0 2,005 Jan-10-2021, 01:29 AM
Last Post: new2datasci
  Pandas merge question smw10c 2 5,813 Jul-02-2020, 06:56 PM
Last Post: hussainmujtaba
  Counting Criteria in Pandas Question Koenig 1 2,237 Sep-30-2019, 05:16 AM
Last Post: perfringo
  Function question using Pandas smw10c 7 7,249 Feb-12-2019, 06:52 PM
Last Post: Nathandsn
  Simple pandas dataframe question popohoma 1 3,615 Jan-03-2019, 05:00 PM
Last Post: ashlardev
  question on pandas datareader kit12_31 3 9,332 Feb-05-2018, 11:55 PM
Last Post: snippsat
  Newbie question to return only the index of a dataframe zydjohn 0 2,619 Jan-22-2018, 03:40 PM
Last Post: zydjohn

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020