Sign up to take part
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Thank you Jrouquie.
Struggled with this as a new user so wanted to share the Python/Pandas recipe. I am strugling to post all of the code in - even if in a code block.
import dataiku
import pandas as pd, numpy as np
from dataiku import pandasutils as pdu
# Read recipe inputs
autoSleep_20190303_20200606_prepared = dataiku.Dataset("AutoSleep_20190303_20200606_prepared")
autoSleep_20190303_20200606_prepared_df = autoSleep_20190303_20200606_prepared.get_dataframe()
#Apply rolling average here
autoSleep_20190303_20200606_prepared_df['bedtime_fortmattedAvg7']=autoSleep_20190303_20200606_prepared_df['bedtime_formatted'].rolling(window=7).mean()
#Output to Dataiku
autoSleep_RollingAverage_df = autoSleep_20190303_20200606_prepared_df
#Update column with MA
autoSleep_RollingAverage = dataiku.Dataset("AutoSleep_RollingAverage")
#autoSleep_RollingAverage.write_with_schema(autoSleep_RollingAverage_df)