I am struggling with the following problem. I have multiple individual dataframes (50) which each contain one specific characteristic for a number of stocks (say price, standard deviation etc), so something like this:
import pandas as pd import numpy as np dates = pd.date_range('20130101',periods=6) df1 = pd.DataFrame(np.random.randn(6,4),index=dates,\ columns('AAPL','MSFT','TSLA','GE')) df2 = pd.DataFrame(np.random.randn(6,4),index=dates,\ columns=('AAPL','MSFT','TSLA','GE')) df3 = pd.DataFrame(np.random.randn(6,4),index=dates,\ columns=('AAPL','MSFT','TSLA','GE')) df4 = pd.DataFrame(np.random.randn(6,4),index=dates,\ columns=('AAPL','MSFT','TSLA','GE')) Now I would like to merge those in such a way, that I obtain one dataframe for each stock that contains all of the characteristics for that particular stock, so something like this:
aapl = pd.DataFrame(np.random.randn(6,4),index=dates,\ columns=('AAPL1','AAPL2','AAPL3','AAPL4')) msft = pd.DataFrame(np.random.randn(6,4),index=dates,\ columns=('MSFT1','MSFT2','MSFT3','MSFT4')) tsla = pd.DataFrame(np.random.randn(6,4),index=dates,\ columns=('TSLA1','TSLA2','TSLA3','TSLA4')) ge = pd.DataFrame(np.random.randn(6,4),index=dates,\ columns=('GE1','GE2','GE3','GE4'))