2

I have two data frames: df1

Data frame 1 :df1

and df2

Data frame 2: df2

Now I want to replace one of rows of df1 (highlighted in red colour) with all values of df2. I try with following codes but didn't give the desired result. Here is the code:

df1[df1['Category_2']=='Specified Functionality'].update(df2)

I also tried:

df1[df1['Category_2']=='Specified Functionality'] = df2

Could anyone guide me where I am making the mistake?

1
  • Can you please post the actual data as text instead of pictures of the data? Commented Mar 20, 2019 at 0:16

1 Answer 1

1

You can insert the rows like this:

row = 13
df2 = df2.rename(columns = {'Functionality': 'Category_2')
df = pd.concat([df1[0:row], df2, df1[row+1:]]).reset_index(drop=True)
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.