concat#
- muldataframe.concat(arr: list[MulSeries | MulDataFrame], axis=0)#
Concatenate muldataframe objects along a particular axis.
The list of muldataframe objects are joined by the primary index or columns depending on the specified axis. Index or columns dataframes along the axis are concatenated. Index or columns dataframes on the other axis are ignored except for the first one. The first one is used as the index or columns dataframe of the final muldataframe object. Currently, only inner join is supported.
Parameters#
- objsa list of MulSeries or MulDataFrame objects
It can be a mix of mulseries and muldataframes.
- axis{0, 1}, default 0
The axis to concatenate along.
Returns#
- MulSeries or MulDataFrame
It will return a mulseries only if the objects in the list are all mulseries and are concatenated along
axis=0
Examples#
>>> import pandas as pd >>> import muldataframe as md >>> index = pd.DataFrame([[1,2],[3,6],[5,6]], index=['a','b','c'], columns=['x','y']) >>> columns = pd.DataFrame([[5,7],[3,6]], index=['c','d'], columns=['f','g']) >>> mf = md.MulDataFrame([[1,2],[8,9],[8,10]],index=index, columns=columns) >>> ms = md.MulSeries([5,6,7], index=pd.DataFrame(index=['a','b','c']), name=pd.Series([8,9],index=['g','f'])) >>> pd.concat([mf,ms],axis=1) (3, 3) g 7 6 8 f 5 3 9 c d k -------- ------------ x y c d k a 1 2 a 1 2 5 b 3 6 b 8 9 6 c 5 6 c 8 10 7 >>> pd.concat([ms,mf],axis=1) (3, 3) f 9 5 3 g 8 7 6 k c d ---------------- ------------ Empty DataFrame k c d Columns: [] a 5 1 2 Index: [a, b, c] b 6 8 9 c 7 8 10
MulDataFrame