-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: AttributeError: 'BlockManager' object has no attribute 'is_mixed_type' when trying to jsonify dataframe. #39837
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@yuvalmarciano Thanks for the report! pandas/pandas/_libs/src/ujson/python/objToJSON.c Lines 275 to 277 in 8967241
Now, would you be able to provide a reproducible example that triggers the error (will be needed to write a test for it). With a small dummy example, I don't get the error:
|
@jorisvandenbossche Thanks!!
Let me know if there's anything else missing. |
@yuvalmarciano with "reproducible" example, I meant a code snippet that someone else can run as well. In your example code, there is a csv file we don't have. Also, I suppose that the actual csv reading / iterator is not needed to reproduce the issue. See https://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports for some more explanation. |
But my small example is apparently enough, if indeed ran on pypy:
Might be that |
Yeah, I meant any CSV file (mine is a minimal one with three text columns) would cause this error. Sorry for not being clear enough. |
Sounds right to me |
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
(optional) I have confirmed this bug exists on the master branch of pandas.
Code Sample, a copy-pastable example
Problem description
on pypy 7.3.3 - python 3.7.9
to_json
execution raises an exception:I suspect this PR: https://github.com/pandas-dev/pandas/pull/36873/files
@jbrockmendel do you mind explaining why the
BlockManager
no longer has theis_mixed_type
property?Expected Output
When I try to manually assign
is_mixed_type
to thechunk._mgr
object, as dropped in the aforementioned PR (aBlockManager
) it seems to be working fine:Output of
pd.show_versions()
INSTALLED VERSIONS
commit : 7d32926
python : 3.7.9.final.0
python-bits : 64
OS : Linux
OS-release : 4.19.121-linuxkit
Version : #1 SMP Tue Dec 1 17:50:32 UTC 2020
machine : x86_64
processor :
byteorder : little
LC_ALL : None
LANG : C.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.2.2
numpy : 1.20.1
pytz : 2021.1
dateutil : 2.8.1
pip : 20.3.4
setuptools : 53.0.0
Cython : None
pytest : 6.2.2
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : 2.8.6 (dt dec pq3 ext lo64)
jinja2 : 2.11.3
IPython : 7.20.0
pandas_datareader: None
bs4 : None
bottleneck : None
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : 1.3.23
tables : None
tabulate : 0.8.7
xarray : None
xlrd : 1.2.0
xlwt : None
numba : None
The text was updated successfully, but these errors were encountered: