Description
Pandas version checks
-
I have checked that this issue has not already been reported.
-
I have confirmed this bug exists on the latest version of pandas.
-
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
import pandas as pd
import numpy as np
from array import array
df = pd.DataFrame({"A": [2,4,6,8]})
cenlon = array('d')
cenlon.append(45.345343)
# Problem
df.loc[0, 'CenLon'] = cenlon
# Solution 1
# df.loc[0, 'CenLon'] = np.array(cenlon)
# Solution 2
# df['CenLon'] = ''
# df.loc[0, 'CenLon'] = cenlon
Issue Description
If the Example above is running in a jupyter notebook, the notebook gets stuck and no error message is shown. The error message only appears in the console where the jupyter notebook is running. From the notebook inside it looks like the cell is still computing. The Example also includes two solutions to it, but a decent error message still would be nice.
Expected Behavior
It would be great if the error message would be displayed directly in the notebook or the provided datatype should be supported again.
As background info: this datatype you will get when working with geopandas (https://geopandas.org/en/stable/index.html) and shaply (https://shapely.readthedocs.io/en/stable/manual.html) and you want to extract the centre coordinates of a geometry. Further, I think this was supported in a previous pandas version as the error just appeared on an older notebook (if wanted I could try to find out up to which version or you decide it is not supported anymore then I will let shaply and geopandas know).
Installed Versions
pandas : 1.4.1
numpy : 1.22.3
pytz : 2021.3
dateutil : 2.8.2
pip : 22.0.4
setuptools : 59.8.0
Cython : 0.29.28
pytest : 7.0.1
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.0.3
IPython : 8.1.1
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
fsspec : 2022.02.0
gcsfs : None
matplotlib : 3.5.1
numba : None
numexpr : 2.8.0
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : 1.8.0
sqlalchemy : None
tables : 3.7.0
tabulate : None
xarray : 2022.3.0
xlrd : None
xlwt : None
zstandard : None