Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

dataframe rolling first eleemnt

rolling_first = df.rolling(3).agg(lambda rows: rows[0])
rolling_last  = df.rolling(3).agg(lambda rows: rows[-1])
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #dataframe #rolling #eleemnt
ADD COMMENT
Topic
Name
3+1 =