I have something like a matrix of empty dataframes.
A = {'folder1':{'case1':pd.Dataframe(), 'case2':pd.Dataframe(),... , 'case8':pd.Dataframe()}\
{'folder2':{'case1':pd.Dataframe(), 'case2':pd.Dataframe(),... , 'case8':pd.Dataframe()}\
...
{'foldern':{'case1':pd.Dataframe(), 'case2':pd.Dataframe(),... , 'case8':pd.Dataframe()}}
In which A[folder][case] is a empty DataFrame.
I already have another dict of dicts of non-empty dataframes of the form
BASIS = {'folder1':{'arch01':pd.Dataframe(...), 'arch02':pd.Dataframe(...)}\
{'folder2':{'arch01':pd.Dataframe(...), 'arch02':pd.Dataframe(...)}\
...
{'foldern':{'arch01':pd.Dataframe(...), 'arch02':pd.Dataframe(...)}}
In which BASIS[folder][arch] is a non-empty dataframe with lots of row I want to separate to others A[folder]['case'].
For example, BASIS[folder]['arch01'] is going to be devided into A[folder]['case1'] + A[folder]['case2'] + A[folder]['case3']
Basically I want to devide [arch] in ['casei'], ['casej'] where 'i' and 'j' are the cases where some conditions happen
I'm trying to give values to these dataframe this way:
for folder in ['folder1', 'folder2',... 'foldern']:
IRLB = BASIS[folder]["arch01"].copy()
condition01 = IRLB.loc[(IRLB['Column3'].str.contains('AAA',case=False))]
A[folder]['case1'] = A[folder]['case1'].append(condition01)
condition02 = IRLB.loc[(IRLB['Column3'].str.contains('BBB',case=False))]
A[folder]['case2'] = A[folder]['case2'].append(condition02)
... (and other conditions to others cases of A)
I'm getting the following error: Only the last folder of A is being filled, the other ones still empty dataframes.