Answers for "How to add two single dataframes into single dataframe"

0

pandas combine two data frames with same index and same columns

pd.merge(df1, df2, left_index=True, right_index=True, how='outer')
Posted by: Guest on April-21-2020
0

append two dataframes pandas

import pandas as pd

# First DataFrame
df1 = pd.DataFrame({'id': ['A01', 'A02', 'A03', 'A04'],
                    'Name': ['ABC', 'PQR', 'DEF', 'GHI']})
  
# Second DataFrame
df2 = pd.DataFrame({'id': ['B05', 'B06', 'B07', 'B08'],
                    'Name': ['XYZ', 'TUV', 'MNO', 'JKL']})
  
frames = [df1, df2]
  
result = pd.concat(frames)
Posted by: Guest on July-16-2021

Code answers related to "How to add two single dataframes into single dataframe"

Python Answers by Framework

Browse Popular Code Answers by Language