I try to perform some process on all Dataframe I have by using for loop by nothing changes.
Codes:
import pandas as pd
a = pd.DataFrame({'a':[1,2,3,4,5,6,7],
                 'b':[8,9,0,1,2,3,4]})
b = pd.DataFrame({'c':[1,2,3,4,5,6,7],
                 'b':[8,9,0,1,2,3,4]})
li = [a,b]
for i in li:
    'df_{}'.format(i) = i.rename(columns={'b':'test'})
Both a and b outputs:
    a   b
0   1   8
1   2   9
2   3   0
3   4   1
4   5   2
5   6   3
6   7   4
    c   b
0   1   8
1   2   9
2   3   0
3   4   1
4   5   2
5   6   3
6   7   4
Expected output:
    a   test
0   1   8
1   2   9
2   3   0
3   4   1
4   5   2
5   6   3
6   7   4
    c   test
0   1   8
1   2   9
2   3   0
3   4   1
4   5   2
5   6   3
6   7   4
can anyone point out what is wrong here? I try to use it on other dataset but nothing changes and I do not understand why. Please help.
Btw, I am wondering whether if I can make a different name for it like. above edited?
 
     
     
    