Package: a-pandas-ex-multimerge
Merges multiple DataFrames, ignores Exceptions if desired$pipinstalla-pandas-ex-multimerge# Ignores all Exceptions, but prints them, this behavior can be changed by passing disable=Truefroma_pandas_ex_multimergeimportpd_add_multimergeimportpandasaspdpd_add_multimerge()df1=pd.DataFrame({"A":["A0","A1","A2","A3"],"B":["B0","B1","B2","B3"],"C":["C0","C1","C2","C3"],"D":["D0","D1","D2","D3"],},index=[0,1,2,3],)df2=pd.DataFrame({"A":["A4","A5","A6","A7"],"B":["B4","B5","B6","B7"],"C":["C4","C5","C6","C7"],"D":["D4","D5","D6","D7"],},index=[4,5,6,7],)df3=pd.DataFrame({"A":["A8","A9","A10","A11"],"B":["B8","B9","B10","B11"],"C":["C8","C9","C10","C11"],"D":["D8","D9","D10","D11"],},index=[8,9,10,11],)t1=df1.ds_multimerge(dataframes=[df2,df3],on_index=False,columns_to_merge=None,print_exception=True,how="outer",disable=False,)t2=df2.ds_multimerge(dataframes=[df2,df3],on_index=True,columns_to_merge=None,print_exception=False,how="outer",disable=False,)t3=df3.ds_multimerge(dataframes=[df1,df2,""],on_index=False,columns_to_merge=None,# will merge on all common columnsprint_exception=True,how="outer",disable=False,)t4=df1.ds_multimerge(dataframes=[df2,df3,1],on_index=True,columns_to_merge=None,print_exception=False,how="outer",disable=False,)t5=df1.ds_multimerge(dataframes=[df2,df3,1,],# won't raise an Exception. The string will be ignoredon_index=False,columns_to_merge=["A","B"],how="outer",print_exception=False,disable=False,)t6=df2.ds_multimerge(dataframes=[df1,df3,1,],# won't raise an Exception. The number will be ignoredon_index=False,columns_to_merge=["C","D"],how="outer",print_exception=True,disable=False,)t7=df2["A"].ds_multimerge(dataframes=[df1,df3,1,],# won't raise an Exception. The number will be ignoredon_index=False,columns_to_merge=None,how="outer",print_exception=True,)IgnoresallExceptions,butprintsthem,thisbehaviorcanbechangedbypassingdisable=Truedescriptor'union'for'set'objectsdoesn't apply to a 'function' objectdescriptor'union'for'set'objectsdoesn't apply to a 'function' objectdescriptor'union'for'set'objectsdoesn't apply to a 'function' objectdescriptor'union'for'set'objectsdoesn't apply to a 'function' objectdescriptor'union'for'set'objectsdoesn't apply to a 'function' objectCanonlymergeSeriesorDataFrameobjects,a<class'str'> was passedCanonlymergeSeriesorDataFrameobjects,a<class'int'> was passeddescriptor'union'for'set'objectsdoesn't apply to a 'function' objectdescriptor'union'for'set'objectsdoesn't apply to a 'function' objectdescriptor'union'for'set'objectsdoesn't apply to a 'function' objectCanonlymergeSeriesorDataFrameobjects,a<class'int'> was passedt7Out[4]:AB_xC_xD_xB_yC_yD_y0A4NaNNaNNaNNaNNaNNaN1A5NaNNaNNaNNaNNaNNaN2A6NaNNaNNaNNaNNaNNaN3A7NaNNaNNaNNaNNaNNaN4A0B0C0D0NaNNaNNaN5A1B1C1D1NaNNaNNaN6A2B2C2D2NaNNaNNaN7A3B3C3D3NaNNaNNaN8A8NaNNaNNaNB8C8D89A9NaNNaNNaNB9C9D910A10NaNNaNNaNB10C10D1011A11NaNNaNNaNB11C11D11t1Out[5]:ABCD0A0B0C0D01A1B1C1D12A2B2C2D23A3B3C3D34A4B4C4D45A5B5C5D56A6B6C6D67A7B7C7D78A8B8C8D89A9B9C9D910A10B10C10D1011A11B11C11D11t2Out[6]:A_xB_xC_xD_xA_yB_yC_yD_yABCD4A4B4C4D4A4B4C4D4NaNNaNNaNNaN5A5B5C5D5A5B5C5D5NaNNaNNaNNaN6A6B6C6D6A6B6C6D6NaNNaNNaNNaN7A7B7C7D7A7B7C7D7NaNNaNNaNNaN8NaNNaNNaNNaNNaNNaNNaNNaNA8B8C8D89NaNNaNNaNNaNNaNNaNNaNNaNA9B9C9D910NaNNaNNaNNaNNaNNaNNaNNaNA10B10C10D1011NaNNaNNaNNaNNaNNaNNaNNaNA11B11C11D11t3Out[7]:ABCD0A8B8C8D81A9B9C9D92A10B10C10D103A11B11C11D114A0B0C0D05A1B1C1D16A2B2C2D27A3B3C3D38A4B4C4D49A5B5C5D510A6B6C6D611A7B7C7D7t4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