Pandas Series concat引发错误

时间:2014-07-23 09:34:52

标签: python pandas concat series

我不明白这里发生了什么:

s1 = pd.Series([1, 2, 3], index=['A', 'B', 'C'], name='s1')
s2 = pd.Series([4,5,6], index=['A', 'B', 'D'], name='s2')

,而

pd.concat([s1, s2])

给出

A    1
B    2
C    3
A    4
B    5
D    6

pd.concat([s1, s2], axis=1)

给出错误:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/pymodules/python2.7/pandas/tools/merge.py", line 690, in concat
verify_integrity=verify_integrity)
File "/usr/lib/pymodules/python2.7/pandas/tools/merge.py", line 749, in __init__
 self.new_axes = self._get_new_axes()
File "/usr/lib/pymodules/python2.7/pandas/tools/merge.py", line 876, in _get_new_axes
 new_axes[self.axis] = concat_axis
IndexError: list assignment index out of range

我的熊猫版本是&#39; 0.7.0&#39;。这可能是个问题吗?

0 个答案:

没有答案