-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: to_clipboard fails to format output for Excel #21111
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
Changes from 6 commits
742aa3b
a8c098d
1fee38f
5204489
fd1d3dd
8439dfe
753e239
ba4bc36
ef8bf54
4d8a1aa
ce02a40
b46159a
f698ed6
2b7b891
009e3e9
c4cc756
cd4be4b
f7bc16f
30f5d78
e363374
1a3a6d2
5013d67
24a650f
5db662f
3939bf3
e50b752
676a58c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ | |
from pandas.util import testing as tm | ||
from pandas.util.testing import makeCustomDataframe as mkdf | ||
from pandas.io.clipboard.exceptions import PyperclipException | ||
from pandas.io.clipboard import clipboard_set | ||
from pandas.io.clipboard import clipboard_set, clipboard_get | ||
|
||
|
||
try: | ||
|
@@ -81,6 +81,7 @@ def test_round_trip_frame_sep(self): | |
self.check_round_trip_frame(dt, sep=',') | ||
self.check_round_trip_frame(dt, sep=r'\s+') | ||
self.check_round_trip_frame(dt, sep='|') | ||
self.check_round_trip_frame(dt, sep='\t') | ||
|
||
def test_round_trip_frame_string(self): | ||
for dt in self.data_types: | ||
|
@@ -123,6 +124,15 @@ def test_read_clipboard_infer_excel(self): | |
exp = pd.read_clipboard(**clip_kwargs) | ||
|
||
tm.assert_frame_equal(res, exp) | ||
|
||
def test_excel_clipboard_format(self): | ||
for dt in self.data_types: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same thing here - can we replace the loops with parametrization? |
||
for sep in ['\t', None]: | ||
data = self.data[dt] | ||
data.to_clipboard(excel=True, sep=sep) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you also test with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You mean to test There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, right, I meant to the default
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point. Should be added |
||
result = read_clipboard(sep='\t', index_col=0) | ||
tm.assert_frame_equal(data, result, check_dtype=False) | ||
assert clipboard_get().count('\t') > 0 | ||
|
||
def test_invalid_encoding(self): | ||
# test case for testing invalid encoding | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add some comments on these cases (including the existing ones).