Join GitHub today
to_clipboard is no longer Excel compatible #12529
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.
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?).