import knime.scripting.io as knio
This example script creates an output table containing randomly drawn integers using numpy and pandas.
import pandas as pd
import numpy as np
#from sklearn.model_selection import train_test_split
df = pd.read_csv(‘C:\Users\sbatr\Downloads\discharge.csv’)
#df = df[(df[‘Battery’] == ‘B0005’) | (df[‘Battery’] == ‘B0006’)]
df = df[df[‘Battery’] == ‘B0005’]
df = df[df[‘Temperature_measured’] > 36] #choose battery B0005
#df[‘Time’] =pd.to_datetime(df[‘Time’], unit=‘s’)
#sorted_df=df.sort_values(by=[‘Battery’, ‘id_cycle’])
#dfb=sorted_df.groupby(‘Battery’).max()
#dfc = dfb.groupby([‘Battery’]).mean()
dfb = df.groupby([‘id_cycle’]).max()
dfb[‘Cumulated_T’] = dfb[‘Time’].cumsum()
knio.output_tables[0] = knio.Table.from_pandas(dfb)
#df1 = pd.DataFrame()