如何按行添加或连接两个或多个列表以在 Python 中创建数据框

How to add or concatenate two or more lists row wise to create dataframe in Python

我想按行添加两个或更多列表/pandas 系列以制作数据框,我该怎么做? 例如, 输入=

a=[1,2,3,4]
b=[9,8,7,6]  

(或者pandas系列可以有)

期望输出=

1 2 3 4
9 8 7 6

创建 lists/Series 的列表并传递给 DataFrame 构造函数:

L = [a,b]
df = pd.DataFrame(L)
print (df)
   0  1  2  3
0  1  2  3  4
1  9  8  7  6