Skip to content

Make os.linesep default line_terminator in to_clipboard #13125

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

Closed
wants to merge 1 commit into from

Conversation

Winand
Copy link
Contributor

@Winand Winand commented May 10, 2016

closes #11720

  • Make os.linesep default line_terminator in to_clipboard
  • Add line_terminator kw to Series.to_csv
  • Refactor to_clipboard

Observed/fixed problems in to_clipboard:

  • try..except: pass
  • excel=None, though it defaults to True
  • several code paths with return
  • sep argument could be passed via kwargs
  • "other keywords are passed to to_csv" only if excel=True
  • line_terminator kw isn't supported by Series to_csv

Is it ok to to change Series.to_csv api?
Also we need tests, right? But what does # pragma: no cover mean?

@jreback
Copy link
Contributor

jreback commented May 10, 2016

tests are in the obvious location: https://github.com/pydata/pandas/blob/master/pandas/io/tests/test_clipboard.py

pls add tests.

@jreback jreback added Windows Windows OS Compat pandas objects compatability with Numpy or Python functions labels May 10, 2016
@Winand
Copy link
Contributor Author

Winand commented May 10, 2016

Have no time today. will add asap

@codecov-io
Copy link

codecov-io commented May 12, 2016

Current coverage is 84.11% (diff: 80.00%)

Merging #13125 into master will decrease coverage by 1.12%

@@             master     #13125   diff @@
==========================================
  Files           140        138     -2   
  Lines         50563      50388   -175   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
- Hits          43103      42386   -717   
- Misses         7460       8002   +542   
  Partials          0          0          

Powered by Codecov. Last update 37f95ce...255895f

@Winand
Copy link
Contributor Author

Winand commented May 12, 2016

  • compatibility fixes
  • tests

elif isinstance(obj, DataFrame):
if 'sep' in kwargs:
if kwargs['sep']:
raise ValueError("sep kw is unsupported with excel=False")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe i should remove ValueError here? just delete sep kw (if it's None) for backwards compatibility. And let to_string to raise error otherwise.

@jreback
Copy link
Contributor

jreback commented Sep 9, 2016

can you rebase / update?

@Winand
Copy link
Contributor Author

Winand commented Sep 9, 2016

I'll look into it on monday.

Add line_terminator kw to Series.to_csv
Refactor to_clipboard

Observed problems in to_clipboard:
* try..except: pass
* excel=None, though it defaults to True
* several code paths with return
* sep argument could be passed via kwargs
* "other keywords are passed to to_csv" only if excel=True
* line_terminator kw isn't supported by Series to_csv (+1 squashed commits)

Squashed commits:

[813f1fc] Make os.linesep default line_terminator in to_clipboard
Add line_terminator kw to Series.to_csv
Refactor to_clipboard

Observed problems in to_clipboard:
* try..except: pass
* excel=None, though it defaults to True
* several code paths with return
* sep argument could be passed via kwargs
* "other keywords are passed to to_csv" only if excel=True
* line_terminator kw isn't supported by Series to_csv
@Winand
Copy link
Contributor Author

Winand commented Sep 12, 2016

Rebased.

@@ -80,6 +82,14 @@ def test_round_trip_frame(self):
for dt in self.data_types:
self.check_round_trip_frame(dt)

def test_linesep(self):
pd.DataFrame().to_clipboard()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need a fair amount more tests. these need to exercise all of the paths that are defined above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean check all self.data dataframes? But again i don't understand, we need to check only line separator. Why test dataframes with different data?

@jreback
Copy link
Contributor

jreback commented Nov 22, 2016

same comment as on the issue. 4a1a330 updated the vendored pyperclip.

is this PR still relevant?

@jreback
Copy link
Contributor

jreback commented Dec 26, 2016

closing, but if you want to update / respond we can reopen

@jreback jreback closed this Dec 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Compat pandas objects compatability with Numpy or Python functions Windows Windows OS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

to_clipboard wrong linebreaks on Windows
3 participants