【发布时间】:2019-12-20 11:04:21
【问题描述】:
我正在尝试拥有一个包含以下两个输出的数据框,并排为列:
finalcust = mainorder_df, custname1_df
print(finalcust)
finalcust
Out[46]:
(10 10103.0
26 10104.0
39 10105.0
54 10106.0
72 10107.0
...
2932 10418.0
2941 10419.0
2955 10420.0
2977 10424.0
2983 10425.0
Name: ordernumber, Length: 213, dtype: float64,
1 Signal Gift Stores
2 Australian Collectors, Co.
3 La Rochelle Gifts
4 Baane Mini Imports
5 Mini Gifts Distributors Ltd.
...
117 Motor Mint Distributors Inc.
118 Signal Collectibles Ltd.
119 Double Decker Gift Stores, Ltd
120 Diecast Collectables
121 Kelly's Gift Shop
Name: customerName, Length: 91, dtype: object)
我试过 pd.merge 但它说我不被允许,因为没有公共列。
有人知道吗?
【问题讨论】:
-
显然它们有不同的长度(第一个有 2983 个值,第二个只有 121 个)。您打算如何将它们并排放置在数据框中?
-
你试过
pd.concat(finalcust, axis=1)吗?请注意,它通过 2 系列的 index 加入