<pre><code>d=[df1,df2,df3]#Put DataFrames in a list
for x in d:
pd.melt(x, id_vars=','.join(list(x.filter(regex="^Value", axis=1).columns)), value_vars=','.join(list(x.filter(regex="^Item", axis=1).columns)))#x.rename(columns={','.join(list(x.filter(regex=["^Value"#], axis=1).columns)):'Values'}, inplace=True)#Melt the dataframes
final_df = pd.concat([df1, df2, df3], axis = 1)#Concat the dataframes
print(final_df)
ValueX Item3 Item4 ValueY Item1 Item2 ValueZ Item5 Item6
0 0.0 a f 1 a a 6.0 a f
1 0.0 e s 1 c e 6.0 e s
2 0.0 d h 1 c d 6.0 d h
3 0.0 g k 1 g g 6.0 g k
4 0.0 f f 1 a f 6.0 f f
5 0.0 c d 3 c c 7.0 c d
6 2.0 c c 3 c c 7.0 c c
7 2.0 f g 3 g f 7.0 f g
8 2.0 b b 3 a b 7.0 b b
9 2.0 c k 3 c c 7.0 c k
10 2.0 j j 3 c j 7.0 j j
11 4.0 g n 5 g g 8.0 g n
12 4.0 m r 5 a m 8.0 m r
13 4.0 s d 5 c s 8.0 s d
14 4.0 c x 5 c c 8.0 c x
15 4.0 k d 5 g k 8.0 k d
16 NaN NaN NaN 5 k k NaN NaN NaN
</code></pre>