Home > Back-end >  Iterate over parts of data in dataframe
Iterate over parts of data in dataframe

Time:07-05

Data: Data visualed in excel

  1. I have dataset as seen above.
  2. Can i use python to create dataframes: first red, do some calculations, save results. Create the blue and do calculations, save some data and green and so on?
  3. HELP! How!?

CodePudding user response:

You can start from here to use pandas and load up the data from the excel file in a dataframe df, then do something like

for window in df.rolling(window=2):
    # computation on the sliding window...

CodePudding user response:

You need to be more specific about the calculation you need to perform. But what you are looking for is a rolling window

df_result = df.rolling(window=size_of_window).apply(func_to_apply)
  • Related