Skip to content
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

API: default export for to_clipboard is now csv/tsv suitable for excel (GH3368) #5070

Merged
merged 1 commit into from
Oct 16, 2013

Conversation

jreback
Copy link
Contributor

@jreback jreback commented Oct 1, 2013

closes #3368

@jtratner
Copy link
Contributor

jtratner commented Oct 2, 2013

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?)

@ghost
Copy link

ghost commented Oct 2, 2013

to_clipboard()'s current behaviour is useful for other things, how about df.to_clipboard(excel=False)?

@jtratner
Copy link
Contributor

jtratner commented Oct 2, 2013

@jreback excel=False is fine, but that'd just be a synonym for sep=',' right?

@jreback
Copy link
Contributor Author

jreback commented Oct 2, 2013

I think we make \t the default, maybe make it a config option as well? io.clip.sep?

@jreback
Copy link
Contributor Author

jreback commented Oct 2, 2013

@y-p I will update docs/announcemnt not sure an explicity excel kw is necessary

@ghost
Copy link

ghost commented Oct 2, 2013

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.

@jreback
Copy link
Contributor Author

jreback commented Oct 2, 2013

@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

@jreback
Copy link
Contributor Author

jreback commented Oct 2, 2013

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.

@ghost
Copy link

ghost commented Oct 2, 2013

right. I thought it'd be best if to_clip(excel=False) kept the current behaviour, and to_clip(1)
generated a csv.

@jreback
Copy link
Contributor Author

jreback commented Oct 9, 2013

@jtratner @y-p further comments? do we need an excel kw?

jreback added a commit that referenced this pull request Oct 16, 2013
API: default export for to_clipboard is now csv (GH3368)
@jreback jreback merged commit eba6001 into pandas-dev:master Oct 16, 2013
@ghost
Copy link

ghost commented Oct 16, 2013

What a bummer to be ignored like that. sadness.

@jreback
Copy link
Contributor Author

jreback commented Oct 16, 2013

@y-p what do you mean? I never saw a comment when I posted a request for further comments...

@ghost
Copy link

ghost commented Oct 16, 2013

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?

@jreback
Copy link
Contributor Author

jreback commented Oct 16, 2013

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?

@ghost
Copy link

ghost commented Oct 16, 2013

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.

@jreback
Copy link
Contributor Author

jreback commented Oct 16, 2013

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

@ghost
Copy link

ghost commented Oct 16, 2013

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?

@jreback
Copy link
Contributor Author

jreback commented Oct 16, 2013

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

@ghost
Copy link

ghost commented Oct 16, 2013

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.

@jtratner
Copy link
Contributor

+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.

@jreback
Copy link
Contributor Author

jreback commented Oct 16, 2013

lol!

@ghost
Copy link

ghost commented Oct 16, 2013

Thanks jeff, it's just right now. :)

@jreback
Copy link
Contributor Author

jreback commented Oct 16, 2013

:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Excel and co. can parse a table from the clipboard, but pandas to_clip uses wrong format
2 participants