If you've ever tried answering questions in pandas, you'll know 90% of them cannot be answered unless the OP posts their data (or, at least a sample) that gives us an idea what they're working with and what their expected output is. Some seasoned askers understand this well and include code we can paste into our terminal that generates the data sample. Most askers, though, just paste a few rows of data from their terminal output, CSV, or spreadsheet and expect us to work off it.
Thankfully, pandas really knows how to make effective tools for devs, so they created pd.read_clipboard
that can load DataFrames from your clipboard.
Often times I am asked by newbies, "how were you able to load the data in the question?" I usually direct them to the documentation or this question, but neither of those links cover important scenarios that need to be considered, such as
- preserving the index
- parsing data with whitespace in the columns
- reading series instead of DataFrames
- parsing columns of python objects
and so on. These cases need to be solved by a special application of various arguments that pd.read_clipboard
offers in conjunction with other libraries, and some of them aren't always cut and dry.
This brings me to the crux of my question: If one were to write a "beginner's manual" for read_clipboard
, where should it go?
I can think of the following options:
- Make it a self-answered post on meta
- Make it a self-answered post on SO main
- Add an answer to How to copy/paste DataFrame from Stack Overflow into Python
Option 1 makes the most sense to me since such a post could be classified as tag-specific guidance on answering questions on Stack Overflow, within a particular tag. I'm not sure if we have other examples of this on meta. The other two examples I'm aware of for "tag specific guidance" are How to make good reproducible pandas examples and How to make a great R reproducible example, both of which are closed, so that doesn't make Option 2 a promising one. Finally, Option 3 would make the post less discoverable, although I'm not sure it would be anyless discoverable than Option 1, which only a very small portion (active meta crowd, or anyone who goes searching for it) would actually see.
Look forward to hearing your thoughts. If you are interested to know more about the content of the post, I've created a rough draft with the topic outlines here.