Skip to content Skip to sidebar Skip to footer

Converting 3d List Into Pandas Single Dataframe On Same Index

My list l has shape np.array(l).shape (100,15,1) It has 100 dataframes with each df having 15 rows and 1 column. The index are same, just the sorting is different in each df of lis

Solution 1:

Use concat with axis=1 and ignore_index=True for default new columns by range:

df = pd.concat(l, axis=1, ignore_index=True)
print (df)
      0    1
A1  1.0  2.0
A2  2.0  NaN
A3  3.0  4.0
A4  4.0  NaN
A5  NaN  1.0
A8  NaN  3.0

Post a Comment for "Converting 3d List Into Pandas Single Dataframe On Same Index"