Python Pandas merge only certain columns -


is possible merge columns? have dataframe df1 columns x, y, z, , df2 columns x, ,b, c, d, e, f, etc.

i want merge 2 dataframes on x, want merge columns df2.a, df2.b - not entire dataframe.

the result dataframe x, y, z, a, b.

i merge delete unwanted columns, seems there better method.

you merge sub-dataframe (with columns):

df2[list('xab')]  # df2 columns x, a, , b  df1.merge(df2[list('xab')]) 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -