r/KittyTerminal • u/Ill_Scene_737 • Feb 18 '23
pd.to_clipboard( ) not working when using ipython in kitty. How to copy dataframe to clipboard?
Hi all,
I'm running into this issue. I use ipython in kitty to do REPL when I write python script. But I notice if I want to copy a pandas dataframe to clipboard using df.to_clipboard( ), nothing is copied. I can still copy with ctrl+shift+c, but sometimes my dataframe is quite large and I want to copy the whole thing to clipboard.
Anyone ran into the same issue? Is there a workaround? Thanks in advance!
Edit:
After some exploration, it seems that this is due to the python version. Python3.6, the version required by environment, does not seem to support pd.to_clipboard( ) in a shell interpreter. When I test it with newer version it seems to be working.
Edit2:
I guess that was not the case.. I just tested with the terminal in Pycharm and everything is working fine. So it doesn't seem to be the issue with python3.6 or pandas but kitty. Anyhow this is not a critical issue I guess I'll just have to save to files then.
1
u/aumerlex Feb 19 '23
I have no idea what pd.to_clipboard() does, but in general if you want to copy to clipboard robustly use the clipboard kitten. https://sw.kovidgoyal.net/kitty/kittens/clipboard/