pandas-dev / pandas

Flexible and powerful data analysis / manipulation library for Python, providing labeled data structures similar to R data.frame objects, statistical functions, and much more
https://pandas.pydata.org
BSD 3-Clause "New" or "Revised" License
43.3k stars 17.8k forks source link

BUG: Getting garbled characters when using pd.to_clipboard() #39764

Closed mbkupfer closed 1 year ago

mbkupfer commented 3 years ago

Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.

Code Sample, a copy-pastable example

N/A

Problem description

I've been running into an issue lately where when is use to_clipboard the results paste into excel with a lot of garbled text. Any idea what can be going on here? I haven't found any minimal example to consistently reproduce, but it is happening a lot for me. to_excel still works interestingly enough, but I do prefer the convenience of the clipboard.

Expected Output

Not this: image

Here's another to verify that it is rather random what I get: image

Output of pd.show_versions()

Does work for me. I get the following error: ``` ImportError: Can't determine version for tables ``` I'm on pandas 1.2.2 though
mbkupfer commented 3 years ago

I now believe this is WSL related as I've tested with the same dataframe on my windows host and it copies fine.

mroeschke commented 1 year ago

If this is a WSL issue I don't think there can be much done on the pandas side so closing. If there is some fix that required updating our vendored version of pyperclip feel free to raise a new issue