Ok here is my question I wan to use multindexing so that I have a 3-d df. I can use
df = pd.concat([df1, df2], keys=('df1','df2'))
but how can I add a new df3 on the df? Essentially I want to add a new df in a loop in an append mode? I have a few thousand dfs and storing all of them before I concat them wont be efficient. Is there a way to do that?
more specific lets assume I have the following df's
df1 = pd.DataFrame(columns=['a', 'b', 'c'])
df2 = pd.DataFrame(columns=['a', 'b', 'c'])
df1.loc['index_1','b'] = 1
df1.loc['index_2','a'] = 2
df2.loc['index_7','a'] = 5
df3 = pd.DataFrame(columns=rating_matrix.columns)
df3.loc['index_9','c'] = 1
df = pd.concat([df1, df2], keys=('df1','df2'))
a b c
df1 index_1 NaN 1 NaN
index_2 2 NaN NaN
df2 index_7 5 NaN NaN
hopw can I add in a similar way df3?