Combine two Pandas dataframes with the same index

alexsalo :

I have two dataframes with the same index but different columns. How do I combine them into one with the same index but containing all the columns?

I have:

  A 
1 10 
2 11

  B
1 20
2 21

and I need the following output:

  A  B
1 10 20
2 11 21
BrenBarn :
pandas.concat([df1, df2], axis=1)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Python Pandas: Combine two dataframes by index AND combine columns with same name

Merging two dataframes with same index in pandas

pandas outer product of two dataframes with same index

merge two dataframes by row with same index pandas

Pandas: How to combine two dataframes by closest index match?

Pandas: combine two dataframes with same columns by picking values

duplicate and combine two dataframes pandas

how to combine two pandas dataframe with same format but different length index

Combine two dataframes by two same variables

Combine two pandas dataframes with two conditionals

How to find the same index between two dataframes and combine it to a new dataframe, Python 3

Combine two dataframes same/different names

pandas: combine two index columns

Combine two pandas index slices

Combine 2 dataframes share the same column in pandas

Combine two pandas DataFrames with one unique column each and keep the row index (Python)

Combine two pandas dataframes adding corresponding values

Pandas: Combine two dataframes and expand rows dynamically

How to combine two Series with the same index in python?

Combing two pandas dataframes, weaving same columns index/title next to one another

Python / Pandas : concatenate two dataframes with multi index

Merge two pandas dataframes using float index

Pandas - Merging two dataframes by index ID

How to join two dataframes using index in pandas?

Merge two pandas dataframes with timeseries index

Pandas apply same filtering on two dataframes

How to combine two dataframes (same shape, including NaN)?

in r combine info from two same-dim dataframes

Combine multiple pandas DataFrames into a multi-index DataFrame