I have a function that takes in a df
--> modifies the df
--> and returns back the modified df
.
I have a list dfs
containing 5 df
- I want to loop over them so that each is modified by the function, something like this:
dfs = [df1, df2, df3, df4, df5] # df1 to df5 : valid DataFrames
for df in dfs:
df = function(df)
When I do that the content of the list dfs
is not changed, I just end up with a new variable called 'df' that contains the modified information of df5
(The last df
in the list).
What am I doing wrong? Is there a way I can achieve this?