-
-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: V1.2 DataFrame.to_csv() fails to write a file with codecs #39247
Comments
thank you for the report and your minimal examples! Yes, that is a regression. Unfortunately it seems that |
https://github.com/simonjayhawkins/pandas/runs/1723695416?check_suite_focus=true perhaps #36997 |
Hello, we still seem to be getting this issue in Pandas 1.2.1, but with another text IO class:
The class that |
oh my, I think there are three directions how to address this:
(3) would probably not be okay for 1.2.* @jreback what do you think is the best short/long-term solution? |
It looks like all of the results of |
@twoertwein 2) sgtm |
It could also be helpful to be able to pass 'wt' as the |
@tgs it should work on master now and will work in 1.2.2:
|
Thank you! We really appreciate the quick fix! |
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.
Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.
Code Sample, a copy-pastable example
Problem description
When saving the file,
TypeError: utf_8_encode() argument 1 must be str, not bytes
flags on.Expected Output
The output below has been obtained by downgrading and pinned Pandas to V1.1.5.
V1.1.2 is also tested OK.
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : 3e89b4c
python : 3.8.2.final.0
python-bits : 64
OS : Darwin
OS-release : 19.6.0
Version : Darwin Kernel Version 19.6.0: Tue Nov 10 00:10:30 PST 2020; root:xnu-6153.141.10~1/RELEASE_X86_64
machine : x86_64
processor : i386
byteorder : little
LC_ALL : None
LANG : None
LOCALE : None.UTF-8
pandas : 1.2.0
numpy : 1.19.2
pytz : 2020.5
dateutil : 2.8.1
pip : 20.3.3
setuptools : 51.1.2.post20210112
Cython : 0.29.21
pytest : 6.2.1
hypothesis : None
sphinx : 3.4.3
blosc : None
feather : None
xlsxwriter : 1.3.7
lxml.etree : 4.6.2
html5lib : 1.1
pymysql : None
psycopg2 : None
jinja2 : 2.11.2
IPython : 7.19.0
pandas_datareader: None
bs4 : 4.9.3
bottleneck : 1.3.2
fsspec : 0.8.3
fastparquet : None
gcsfs : None
matplotlib : 3.3.2
numexpr : 2.7.2
odfpy : None
openpyxl : 3.0.6
pandas_gbq : None
pyarrow : None
pyxlsb : None
s3fs : None
scipy : 1.5.2
sqlalchemy : 1.3.21
tables : 3.6.1
tabulate : None
xarray : None
xlrd : 2.0.1
xlwt : 1.3.0
numba : 0.51.2
The text was updated successfully, but these errors were encountered: