Closed
Description
This showed up in the dask.dataframe test suite when testing against the 0.19 release candidate. I'm unsure if this was an intended change or not:
Pandas 0.18
In [1]: import pandas as pd
In [2]: a = pd.Series([1, 2], index=[1, 1])
In [3]: b = pd.Series([10, 10], index=[1, 2])
In [4]: a
Out[4]:
1 1
1 2
dtype: int64
In [5]: b
Out[5]:
1 10
2 10
dtype: int64
In [6]: a + b
Out[6]:
1 11.0
1 12.0
2 NaN
dtype: float64
Pandas 0.19rc1
In [1]: import pandas as pd
In [2]: a = pd.Series([1, 2], index=[1, 1])
In [3]: b = pd.Series([10, 10], index=[1, 2])
In [4]: a
Out[4]:
1 1
1 2
dtype: int64
In [5]: b
Out[5]:
1 10
2 10
dtype: int64
In [6]: a + b
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-6-f96fb8f649b6> in <module>()
----> 1 a + b
/home/mrocklin/Software/anaconda/lib/python3.5/site-packages/pandas/core/ops.py in wrapper(left, right, name, na_op)
671 return NotImplemented
672
--> 673 left, right = _align_method_SERIES(left, right)
674
675 converted = _Op.get_op(left, right, name, na_op)
/home/mrocklin/Software/anaconda/lib/python3.5/site-packages/pandas/core/ops.py in _align_method_SERIES(left, right, align_asobject)
613 return_indexers=True)
614 # if DatetimeIndex have different tz, convert to UTC
--> 615 left.index = index
616 right.index = index
617
/home/mrocklin/Software/anaconda/lib/python3.5/site-packages/pandas/core/generic.py in __setattr__(self, name, value)
2754 try:
2755 object.__getattribute__(self, name)
-> 2756 return object.__setattr__(self, name, value)
2757 except AttributeError:
2758 pass
pandas/src/properties.pyx in pandas.lib.AxisProperty.__set__ (pandas/lib.c:44336)()
/home/mrocklin/Software/anaconda/lib/python3.5/site-packages/pandas/core/series.py in _set_axis(self, axis, labels, fastpath)
306 object.__setattr__(self, '_index', labels)
307 if not fastpath:
--> 308 self._data.set_axis(axis, labels)
309
310 def _set_subtyp(self, is_all_dates):
/home/mrocklin/Software/anaconda/lib/python3.5/site-packages/pandas/core/internals.py in set_axis(self, axis, new_labels)
2774 raise ValueError('Length mismatch: Expected axis has %d elements, '
2775 'new values have %d elements' %
-> 2776 (old_len, new_len))
2777
2778 self.axes[axis] = new_labels
ValueError: Length mismatch: Expected axis has 3 elements, new values have 5 elements