Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
to_clipboard is no longer Excel compatible #12529
Comments
and the clipboard routines have been updated to use unicode, see #9263 |
jreback
added Unicode IO Excel
labels
Mar 8, 2016
|
AFAICT this didn't work previously. Is the issue that the sep is not getting passed? |
dalito
commented
Mar 8, 2016
|
Yes, the new issue in 0.18.0rc1 (vs. 0.17.x) is that the clipboard content does no longer have a separator (only spaces). Even when I explicitly pass a separator by using the keyword argument, that separator is not used. |
|
ok, certainly could be an issue, can you step thru it and see where its not being passed. |
|
Note that this only happens if there are unicode characters, if you leave out the |
dalito
commented
Mar 8, 2016
|
OK. I have stepped through the sequence of calls and found out that all works fine if an encoding is specified when calling to_clipboard:
Without specifying an encoding, an UnicodeEncodeError ('ascii' codec can't encode character...) is raised in to_csv which is called from to_clipboard here. The error is suppressed so that the user has no idea what went wrong and that an encoding should be passed as kwarg to "to_clipboard". Another consequence of suppressing the error is that a separator passed as kwarg is ignored. I am not sure how to fix this best. Either an error could be raised with a message that an encoding is needed or a default encoding could be used (cp1252 for windows utf8 for all other?). |
|
ahh on why don't we catch the encoding error then raise a helpful message that u need to pass an encoding (rather than just going on) |
dalito
commented
Mar 8, 2016
|
Yes that is what I though, too. I'll prepare a PR. |
jreback
added the
Error Reporting
label
Mar 8, 2016
jreback
added this to the
0.18.1
milestone
Mar 8, 2016
jreback
added Difficulty Novice Effort Low
labels
Mar 8, 2016
dalito
referenced
this issue
Mar 9, 2016
Closed
Fix #12529 / Improve to_clipboard for objects containing unicode #12580
jreback
modified the milestone: 0.18.2, 0.18.1
Apr 25, 2016
jreback
referenced
this issue
Jul 22, 2016
Closed
BUG in clipboard (linux, python2) with unicode and separator #13747
jreback
modified the milestone: 0.19.0, 0.19.1
Sep 28, 2016
jorisvandenbossche
modified the milestone: 0.20.0, 0.19.1
Oct 29, 2016
pijucha
referenced
this issue
Nov 8, 2016
Closed
BUG in clipboard (linux, python2) with unicode and separator (GH13747) #14599
jreback
closed this
in 4a1a330
Nov 18, 2016
jreback
modified the milestone: 0.19.2, 0.20.0
Nov 18, 2016
amolkahat
added a commit
to amolkahat/pandas
that referenced
this issue
Nov 26, 2016
|
|
+ amolkahat |
f96e472
|
jorisvandenbossche
added a commit
to jorisvandenbossche/pandas
that referenced
this issue
Dec 14, 2016
|
|
+ jorisvandenbossche |
6f55ab9
|
dalito commentedMar 5, 2016
Using pandas-0.18.0rc1-cp27-cp27m-win_amd64.whl from Christoh Gohlkes site:
Always gives the same content in the clipboard:
which cannot be pasted to Excel since it does not use tab as separator.
Copy/paste worked fine in pandas 0.17.1 except for unicode characters.
Output of
pd.show_versions():