Python 每行包含2个数据帧

Python 每行包含2个数据帧,python,pandas,concat,Python,Pandas,Concat,我为此而挣扎 我有: import pandas as pd df1 = pd.Series([0, 1, 2, 3]) df2= pd.Series(["A", "B", "C", "D"]) df3 = pd.concat([df1, df2], axis=0) 我的结果是: 0 1 2 3 A B C D 我需要以下输出: 0 A 1 B 2 C 3 D 添加以避免重复索引值: df3 = pd.concat([df1, df2], axis=0).sort_index().

我为此而挣扎

我有:

import pandas as pd

df1 = pd.Series([0, 1, 2, 3])
df2= pd.Series(["A", "B", "C", "D"])

df3 = pd.concat([df1, df2], axis=0)
我的结果是:

0
1
2
3 
A
B
C
D
我需要以下输出:

0
A
1
B 
2
C
3
D
添加以避免重复索引值:

df3 = pd.concat([df1, df2], axis=0).sort_index().reset_index(drop=True)
print (df3)
0    0
1    A
2    1
3    B
4    2
5    C
6    3
7    D
dtype: object
添加以避免重复索引值:

df3 = pd.concat([df1, df2], axis=0).sort_index().reset_index(drop=True)
print (df3)
0    0
1    A
2    1
3    B
4    2
5    C
6    3
7    D
dtype: object

使用
np.insert

   pd.Series(np.insert(df1.astype(str).values,np.arange(len(df1))+1,df2.values))

Out[1105]: 
0    0
1    A
2    1
3    B
4    2
5    C
6    3
7    D
dtype: object

使用
np.insert

   pd.Series(np.insert(df1.astype(str).values,np.arange(len(df1))+1,df2.values))

Out[1105]: 
0    0
1    A
2    1
3    B
4    2
5    C
6    3
7    D
dtype: object

很不清楚你在问什么…很不清楚你在问什么。。。