-
-
Notifications
You must be signed in to change notification settings - Fork 18.3k
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
BUG: 1.2.5 -> 1.3.x breaks yaml.dump(DataFrameObject) #42748
Comments
Thanks @gunthergl for the report - I just left |
if yaml is looking at the internal structures then they need to update the package - these are by definition private and can / |
xref #40226 |
close as won't fix? or add 1.3.2 milestone to track discussion? |
close as won't fix as no details on what is broken |
Thanks @gunthergl for the report. have closed as upstream issue. |
sorry. downstream issue. |
The underlying problem here that's making pyyaml's default representer blow up is that the |
fair enough. PR to avoid the partial would be welcome |
Having the same issue |
changing milestone to 1.3.5 |
@gunthergl working on a fix for this and i could use help writing a test. starting with the |
Hi @jbrockmendel, import pandas as pd
tmp = pd.DataFrame(
{'col_name': [1,2,3,4]}
)
import yaml
dumped = yaml.dump(tmp) # Fails starting with pandas==1.3.0
print(dumped)
loaded_UnsafeLoader = yaml.load(dumped, Loader=yaml.UnsafeLoader)
print(loaded_UnsafeLoader)
loaded_Loader = yaml.load(dumped, Loader=yaml.Loader)
print(loaded_Loader)
assert tmp.equals(loaded_UnsafeLoader)
assert tmp.equals(loaded_Loader) |
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
Another package, pytorch-lightning, has the option to save all given hyperparameters. They yaml all given parameters, which resulted in the kind of ugly output shown in the expected output for dataframes. Starting with
pandas==1.3.0
this breaks because of the MWE shown above.If this is expected behaviour from pandas I am sorry, then the issue should go to pytorch-lightning probably.
Expected Output
Output of
pd.show_versions()
pandas 1.2.5
:INSTALLED VERSIONS
commit : 7c48ff4
python : 3.8.10.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.19042
machine : AMD64
processor : Intel64 Family 6 Model 158 Stepping 10, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : de_DE.cp1252
pandas : 1.2.5
numpy : 1.21.1
pytz : 2021.1
dateutil : 2.8.2
pip : 21.1.3
setuptools : 52.0.0.post20210125
Cython : None
pytest : 6.2.4
hypothesis : None
sphinx : 3.5.4
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.6.3
html5lib : 1.1
pymysql : None
psycopg2 : None
jinja2 : 3.0.1
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
fsspec : 2021.07.0
fastparquet : None
gcsfs : None
matplotlib : 3.4.2
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyxlsb : None
s3fs : None
scipy : 1.6.1
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : 0.51.2
pandas 1.3.1
:INSTALLED VERSIONS
commit : c7f7443
python : 3.8.10.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.19042
machine : AMD64
processor : Intel64 Family 6 Model 158 Stepping 10, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : de_DE.cp1252
pandas : 1.3.1
numpy : 1.21.1
pytz : 2021.1
dateutil : 2.8.2
pip : 21.1.3
setuptools : 52.0.0.post20210125
Cython : None
pytest : 6.2.4
hypothesis : None
sphinx : 3.5.4
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.6.3
html5lib : 1.1
pymysql : None
psycopg2 : None
jinja2 : 3.0.1
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
fsspec : 2021.07.0
fastparquet : None
gcsfs : None
matplotlib : 3.4.2
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyxlsb : None
s3fs : None
scipy : 1.6.1
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : 0.51.2
The text was updated successfully, but these errors were encountered: