Answers for "Append two datasets df_1 and df_2, and print the combined dataframe."

9

combining 2 dataframes pandas

df_3 = pd.concat([df_1, df_2])
Posted by: Guest on May-13-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 "Append two datasets df_1 and df_2, and print the combined dataframe."

Python Answers by Framework

Browse Popular Code Answers by Language