Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/306.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何连接熊猫中的两个数据帧?_Python_Dataframe - Fatal编程技术网

Python 如何连接熊猫中的两个数据帧?

Python 如何连接熊猫中的两个数据帧?,python,dataframe,Python,Dataframe,有两个数据帧 如何按元素连接 你可以看到代码 如果索引和列相同,请使用以下任何数据帧字符串串联操作 df1 + ' ' + df2 string1 string2 0 Hello how are you? This is Sam from Canada 1 Good? morning Are you free to have a talk? “如何获得下一行:”。。。我看到两排了吗?不是1

有两个数据帧

如何按元素连接

你可以看到代码


如果索引和列相同,请使用以下任何数据帧字符串串联操作

df1 + ' ' + df2

              string1                       string2
0  Hello how are you?       This is Sam from Canada
1       Good? morning  Are you free to have a talk?


“如何获得下一行:”。。。我看到两排了吗?不是1。结果如何?
df1 + ' ' + df2

              string1                       string2
0  Hello how are you?       This is Sam from Canada
1       Good? morning  Are you free to have a talk?
df1.add(' ').add(df2)

              string1                       string2
0  Hello how are you?       This is Sam from Canada
1       Good? morning  Are you free to have a talk?
df2.radd(df1.add(' '))

              string1                       string2
0  Hello how are you?       This is Sam from Canada
1       Good? morning  Are you free to have a talk?