Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Data Science by (50.2k points)

I want to perform a join/merge/append operation on a dataframe with the datetime index.

Let's say I have df1 and I want to add df2 to it. df2 can have fewer or more columns and overlapping indexes. For all rows where the indexes match, if df2 has the same column as df1, I want the values of df1 be overwritten with those from df2.

How can I obtain the desired result?

1 Answer

0 votes
by (108k points)

For a merge like in your query, the update method of a DataFrame is useful.

You can take the examples from the following link:

 https://pandas.pydata.org/pandas-docs/stable/user_guide/merging.html

If you wish to learn more about Pandas visit this Pandas Tutorial.

Browse Categories

...