I have three dataframes that I would like to crop, I have defined a function;
def croping(data, start_date='2017-04-10 00:00:00', end_date='2018-05-31 21:55:00' ):
return data.loc[start_date:end_date]
I know this is a bit extra but I am trying to learn how to use user-defined functions.
I then want to use this function on the list of dataframes;
df_list = [df1, df2, df3]
where
df1=
Timestamp A B C D E
2017-04-01 00:00:00 106.46451 98.94002 118.59085 100.83779 108.89098
2017-04-01 00:05:00 105.74346 98.93000 113.47805 86.77218 105.37943
2017-04-01 00:10:00 105.99000 99.15727 115.48461 96.76406 106.55555
2017-04-01 00:15:00 105.04311 98.93000 112.15814 88.38959 104.71931
... ... ... ... ...
etc.
I am then trying to run a for loop to crop each dataframe
for name in df_list:
holding = croping(name)
if I do it this way I need to then append the holding dataframes together, is there a way that I can call the cropped dataframe a different thing in each iteration? Something like this;
for name in df_list:
name_cropped = croping(name)
where name changes in each iteration, so I am left with df1_cropped, df2_cropped etc.
Maybe the best way to do this is not with a for loop, I am still very much learning