The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here

data upsampling with python pandas

Katharina_MULKatharina_MUL Member Posts: 1 Learner I
edited July 2019 in Help

Hello,

 

so I have a little problem. I'd like to upsample my data (timestamp+9 attributes) with python pandas in RapidMiner. In Jupyter it's working fine, but as soon as I'm using the code in the "Execute Python" operator, it won't work. In the result, there a missing values and my timestamp is gone.

One big issue could be the timestamp. The format is like " YYYY-MM-dd HH:mm:ss.SSS" and I'd like to upsample the data to 100 ms. So RapidMiner doesn't show me the format, since it's cutting off the miliseconds.

Do you have any ideas?

Thanks!

 

Code for Jupyter:

import pandas as pd
df = pd.read_csv('aufgefuellt.csv', header=0, sep =';', parse_dates=True)
df['Datum'] = pd.to_datetime(df['Datum'], format='%d-%m-%Y %H:%M:%S.%f')
df.set_index('Datum')
df1 = df.reset_index().set_index('Datum').resample('0.1S').mean()
del df1['index']
df2=df1

 

Code in RapidMiner:

import pandas as pd
def rm_main(data):
data['timestamp'] = pd.to_datetime(data['timestamp'], format='%Y-%m-%d %H:%M:%S.%f')
df1 = data.reset_index().set_index('timestamp').resample('0.1S').mean()
return df1

 

 

 

 

Tagged:
Sign In or Register to comment.