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

时间:2018-08-30 14:18:14

标签: python python-3.x pandas

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

Public Class Menufilter

    Private Sub Tb_bplBindingNavigatorSaveItem_Click(sender As System.Object, e As System.EventArgs) Handles Tb_bplBindingNavigatorSaveItem.Click
        Me.Validate()
        Me.Tb_bplBindingSource.EndEdit()
        Me.TableAdapterManager.UpdateAll(Me.Database1DataSet)
    End Sub

    Private Sub Menufilter_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'Database1DataSet.tb_bpl' table. You can move, or remove it, as needed.
        Me.Tb_bplTableAdapter.Fill(Me.Database1DataSet.tb_bpl)
    End Sub

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        Me.Tb_bplTableAdapter.FillByTwodates(Me.Database1DataSet.tb_bpl, DateTimePicker1.Value.ToString, DateTimePicker2.Value.ToString)
    End Sub

End Class

和DataFrame_2

Opinion    
 Cars   
 Cars
 Cars
 Cars
 Cars
 Cars
 Cars
 Cars

最终数据框架

  Questions
   Like Cars
   Model
   Years
   color

是否有任何熊猫函数可以做到这一点?

1 个答案:

答案 0 :(得分:2)

尝试

DataFrame_2['Opinion'] = 'Cars'