I have 3 dataframes including the information from the same group, now I'm trying to concate these dataframes by their group, by set_index as the group name, but because df1 contains indices that are not unique, hence I'm not able to concate them. Is there any way to bypass that?
samples of inputs df:
df1:
group     A       B
 cat      1       0 
 cat      2       7
 cat      5       5
 dog      0.4     1
 dog      2       4
 dog      8       7 
 seal     7       5
 seal     1       8
 seal     7       9
df2:
group     C       D
 cat      1       3
 seal     0       5    
 dog      3       4
df3:
group     E       F
 cat      1       5
 dog      0       3 
 seal     5       9
wanted ouputs:
group     A       B       C        D       E      F
 cat      1       0       1        3       1      5
 cat      2       7       1        3       1      5
 cat      5       5       1        3       1      5
 dog      0.4     1       3        4       0      3
 dog      2       4       3        4       0      3
 dog      8       7       3        4       0      3 
 seal     7       5       0        5       5      9
 seal     1       8       0        5       5      9
 seal     7       9       0        5       5      9
my code:
 df1 = pd.read(file).set_index('group')
 df2 = pd.read(file).set_index('group')
 df3 = pd.read(file).set_index('group')
 all_data = pd.concate(df1, df2, df3, axis = 1).reset_index()
error:
 pandas.core.indexes.base.InvalidIndexError: Reindexing only valid with uniquely valued Index objects
thanks!
 
    