API: default export for to_clipboard is now csv/tsv suitable for excel (GH3368) by jreback · Pull Request #5070 · pandas-dev/pandas (original) (raw)
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 andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation23 Commits1 Checks0 Files changed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})
We should have a setting io.clipboard.sep
. Can we change to \t
for windows/osx by default and I guess ','
for Linux? (set the defaults in config_init, right?)
to_clipboard()
's current behaviour is useful for other things, how about df.to_clipboard(excel=False)
?
@jreback excel=False
is fine, but that'd just be a synonym for sep=','
right?
I think we make \t the default, maybe make it a config option as well? io.clip.sep
?
@y-p I will update docs/announcemnt not sure an explicity excel kw is necessary
df.to_clip()
can be used to paste a nicely-formatted textual table into a document, that's useful as well.
Not sure making an arg for method invocation into a config option makes sense.
@y-p I actually need to use a sep of ',' to paste as I copy from a linux X window to excel; prob not typical
there is no easy way to actually form the object prior to writing to the clipboad; eg. we are using to_csv and not to_string.
right. I thought it'd be best if to_clip(excel=False)
kept the current behaviour, and to_clip(1)
generated a csv.
jreback added a commit that referenced this pull request
API: default export for to_clipboard is now csv (GH3368)
What a bummer to be ignored like that. sadness.
@y-p what do you mean? I never saw a comment when I posted a request for further comments...
Isn't it clearly better to extend the existing functionality rather then replace it? I made
that point 3 times early on.
It's totally fine you don't agree, but, what's the reasoning?
this doesn't actually change much, except for replacing space separation with tabs sep, which appears to be more compatible with various systems. I believe you pointed out the issue, which tab sep fixes, or is this not the case?
tabs allow you to paste into excel, yeah, but now you can't get an aligned textual table into the clipboard.sep=' '
doesn't replicate the old behavior, try it.
and how would you propose for an API to handle both of these somewhat discordant cases?
as IMHO I would think pasting to excel is much more important
What's wrong with what I suggested above?:
def to_clipboard(excel=False): if not excel: to_string() # -> clip, original behavior else: to_csv(sep='\t') # -> clip , new behavior
Also, why decide which is more important when it's so easy to allow both while
avoiding breakage to existing behaviour at the same time?
ok....that's reasonable....guess I misunderstood what you meant....would have have a problem with default excel=True
? it breaks compat, but I think is more intuitive
I guess there's not much harm in changing the default,since it's easy
to request the old behavior. It's for interactive use only anyway. so yeah, should be fine.
+1 on excel=True as the default, if for no other reason that it'd be a
whizbang feature to show off. Also, I've spent most of the day
copy/pasting into Excel so that's something.
Thanks jeff, it's just right now. :)
This was referenced
Nov 23, 2013
ghost mentioned this pull request
2 participants