Code Sample, a copy-pastable example if possible
import pandas as pd
a = pd.Series([[12]])
b = a + [222]
Problem description
- in pandas version 0.24, the code went well
- in pandas version 0.25.1, the code raise TypeError can only concatenate list (not "int") to list
~\AppData\Local\Continuum\anaconda3\envs\test\lib\site-packages\pandas\core\ops\__init__.py in na_op(x, y)
967 try:
--> 968 result = expressions.evaluate(op, str_rep, x, y, **eval_kwargs)
969 except TypeError:
~\AppData\Local\Continuum\anaconda3\envs\test\lib\site-packages\pandas\core\computation\expressions.py in evaluate(op, op_str, a, b, use_numexpr, **eval_kwargs)
220 if use_numexpr:
--> 221 return _evaluate(op, op_str, a, b, **eval_kwargs)
222 return _evaluate_standard(op, op_str, a, b)
~\AppData\Local\Continuum\anaconda3\envs\test\lib\site-packages\pandas\core\computation\expressions.py in _evaluate_standard(op, op_str, a, b, **eval_kwargs)
69 with np.errstate(all="ignore"):
---> 70 return op(a, b)
71
TypeError: can only concatenate list (not "int") to list
Expected Output
no error should be raised
Output of pd.show_versions()
INSTALLED VERSIONS
------------------
commit : None
python : 3.6.8.final.0
python-bits : 64
OS : Windows
OS-release : 10
machine : AMD64
processor : Intel64 Family 6 Model 142 Stepping 10, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : None.None
pandas : 0.25.1
numpy : 1.16.3
pytz : 2019.1
dateutil : 2.8.0
pip : 19.0.3
setuptools : 41.0.0
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.3.3
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.10.1
IPython : 7.8.0
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : 4.3.3
matplotlib : 3.1.0
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
s3fs : None
scipy : 1.2.1
sqlalchemy : None
tables : None
xarray : None
xlrd : None
xlwt : None
xlsxwriter : None
Comment From: TomAugspurger
cc @jbrockmendel.
I'm not sure if this is something we can easily support right now.
Comment From: jbrockmendel
@Jasonsey what output are you expecting here? A Series with a single entry that is a list [12, 222]
?
Comment From: jbrockmendel
xref #27911
Comment From: Jasonsey
@jbrockmendel Sorry for late. The output what I expect here is [12, 222]
. And I have demoted the version as a temporary solution
Comment From: xumanru
Same problem.You can try 'apply...'to solve it