Closed
Description
Code Sample, a copy-pastable example if possible
In [41]: s
Out[41]:
0 1
1 2
2 3
dtype: Int64
In [42]: s.values
Out[42]: IntegerArray([1, 2, 3], dtype='Int64')
In [43]: s + s.values
---------------------------------------------------------------------------
UnboundLocalError Traceback (most recent call last)
<ipython-input-43-c3f015376225> in <module>()
----> 1 s + s.values
C:\Users\Public\pandas-peter\pandas\core\ops.py in wrapper(left, right)
1231 (is_extension_array_dtype(right) and not is_scalar(right
))):
1232 # GH#22378 disallow scalar to exclude e.g. "category", "Int6
4"
-> 1233 return dispatch_to_extension_op(op, left, right)
1234
1235 elif is_datetime64_dtype(left) or is_datetime64tz_dtype(left):
C:\Users\Public\pandas-peter\pandas\core\ops.py in dispatch_to_extension_op(op,
left, right)
1152 new_right = list(new_right)
1153 elif is_extension_array_dtype(right) and type(left) != type(righ
t):
-> 1154 new_right = list(new_right)
1155 else:
1156 new_right = right
UnboundLocalError: local variable 'new_right' referenced before assignment
Problem description
Extension array add itself cause problems
Expected Output
In [2]: s + s.values
Out[2]:
0 2
1 4
2 6
dtype: Int64
Output of pd.show_versions()
INSTALLED VERSIONS
------------------
commit: 2be2ba5
python: 3.6.4.final.0
python-bits: 64
OS: Windows
OS-release: 7
machine: AMD64
processor: Intel64 Family 6 Model 60 Stepping 3, GenuineIntel
byteorder: little
LC_ALL: None
LANG: zh_CN.UTF-8
LOCALE: None.None
pandas: 0.24.0.dev0+506.g2be2ba570
pytest: 3.7.1
pip: 9.0.1
setuptools: 38.4.0
Cython: 0.28.4
numpy: 1.14.0
scipy: 1.0.0
pyarrow: None
xarray: None
IPython: 6.2.1
sphinx: 1.6.7
patsy: 0.5.0
dateutil: 2.6.1
pytz: 2017.3
blosc: None
bottleneck: 1.2.1
tables: 3.4.2
numexpr: 2.6.4
feather: None
matplotlib: 2.1.2
openpyxl: 2.4.10
xlrd: 1.1.0
xlwt: 1.3.0
xlsxwriter: 1.0.2
lxml: 4.1.1
bs4: 4.6.0
html5lib: 1.0.1
sqlalchemy: 1.2.1
pymysql: 0.7.11.None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
gcsfs: None