如何通过重复一行来连接两个DataFrame?

问题描述 投票:1回答:1

我有两个DataFrame,我需要重复几次问题并将其导出到.csv DataFrame_1:

Opinion    
 Cars   
 Cars
 Cars
 Cars
 Cars
 Cars
 Cars
 Cars

和DataFrame_2

  Questions
   Like Cars
   Model
   Years
   color

最终的DataFrame

  Opinion   Questions
    Cars      Like Cars
    Cars      Model
    Cars      Years
    Cars      Color

任何允许这样做的熊猫功能?

python python-3.x pandas
1个回答
2
投票

尝试

DataFrame_2['Opinion'] = 'Cars'
© www.soinside.com 2019 - 2024. All rights reserved.