'join dataframes with the same index into excel

I'm reading a csv and I'm adding a dataframe to it, but I need you to follow the index consecutively, do you know any way to do it? Attached the code

import pandas as pd

df1 = pd.read_csv("test3.csv")

document = {'price': price, 'get_by': get_by, 'name': name, 'company': company, 'link': link, "date":date,"search_position": search_position } 
df2 = pd.DataFrame(document) 

df3 = pd.concat([df1,df2],axis=1)
df3.to_csv('test3.csv', index=False)

As a result:

enter image description here

df1 and df2 samples

enter image description here



Solution 1:[1]

It seems that df1 has a numbering column (the first column) while df2 doesn't.

The solution is to drop the first column in df1 and use

df3.to_csv('test3.csv', index=True)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Will