1.

How will you combine different pandas dataframes?

Answer»

The dataframes can be combines using the below approaches:

  • append() method: This is used to stack the dataframes horizontally. Syntax:
df1.append(df2)
  • concat() method: This is used to stack dataframes vertically. This is BEST used when the dataframes have the same columns and SIMILAR fields. Syntax:
pd.concat([df1, df2])
  • join() method: This is used for extracting DATA from VARIOUS dataframes having one or more common columns.
df1.join(df2)


Discussion

No Comment Found