Skip to content

DOC: example using clipboard_set for all output formats #46311

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

Merged
merged 2 commits into from
Mar 11, 2022

Conversation

attack68
Copy link
Contributor

@attack68 attack68 commented Mar 10, 2022

rather than change the underlying DataFrame.to_clipboard method, here I just included a simple example to demonstrate how to use pandas to send any output string (in any render format) to the clipboard.

@twoertwein
Copy link
Member

I think clipboard_set is not even listed as a public function: https://pandas.pydata.org/docs/search.html?q=clipboard_set

Might be good to also add it to the web documentation.

@twoertwein
Copy link
Member

twoertwein commented Mar 10, 2022

I think pandas.io.clipboard is currently not declared as a public module (from a typing perspective). It is not listed here

__all__ = ["formats", "json", "stata"]

Would need to add "clipboard" to this list. (edit: and import it)

@mroeschke
Copy link
Member

I'm not 100% sure these helpers were ever supposed to be public (since a lot of this code is vendored from pyperclip anyways).

IMO for the original issue, I would just recommend passing the output of to_html/to_latex/etc to pyperclip directly.

@attack68
Copy link
Contributor Author

I'm not 100% sure these helpers were ever supposed to be public (since a lot of this code is vendored from pyperclip anyways).

IMO for the original issue, I would just recommend passing the output of to_html/to_latex/etc to pyperclip directly.

yes I agree, since pandas just copies the pyperclip module (1.7.0) it is probably worth noting this and stating the user can just import the pyperclip module themselves.

@mroeschke mroeschke added the Docs label Mar 11, 2022
@mroeschke mroeschke added this to the 1.5 milestone Mar 11, 2022
@jreback jreback merged commit ddd4a3b into pandas-dev:main Mar 11, 2022
@jreback
Copy link
Contributor

jreback commented Mar 11, 2022

thanks @attack68

@attack68 attack68 deleted the doc_clipboard branch March 12, 2022 06:05
yehoshuadimarsky pushed a commit to yehoshuadimarsky/pandas that referenced this pull request Jul 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ENH: to_clipboard(as="html" | "markdown" | "latex" | ...)
4 participants