I have created a list of 2 dataframes
df = [pd.DataFrame(0, columns = ['a', 'b', 'c'], index = range(0, 5))] * 2
df[0]['a'][1] = 55
Current output:
[ a b c
0 0 0 0
1 55 0 0
2 0 0 0
3 0 0 0
4 0 0 0, a b c
0 0 0 0
1 55 0 0
2 0 0 0
3 0 0 0
4 0 0 0]
Expected output:
[ a b c
0 0 0 0
1 55 0 0
2 0 0 0
3 0 0 0
4 0 0 0, a b c
0 0 0 0
1 0 0 0
2 0 0 0
3 0 0 0
4 0 0 0]
I would expect this code snippet to assign a value of 1 to the first df, col a and index 1. However it assigns values to both dataframes.
I am not sure if the issue arises because I created the list by multiplying a df by 2, which is resulting in applying the result to all the dfs.
Is there a way to create a list of multiple dfs and have result attached to only one df based on index.
Thanks