im trying to t to create 4 dataframes with an unique id. For example df1, df2,...,df4. And each one should contain data from a main dataframe.
For example, the main df looks like this
id subid a
1 1 1 2
2 1 1 10
3 1 1 20
4 1 2 30
5 1 2 35
6 1 2 36
7 1 3 40
8 2 3 20
9 2 4 49
10 2 4 30
And i want a new df for each subid containing the value from column id and a. So far this is what i have
for i in range(4):
df'i' = maindf[maindf.subid == i]
therefore df4 should look like this
id a
2 49
2 30