diff --git a/doc/source/whatsnew/v0.24.0.txt b/doc/source/whatsnew/v0.24.0.txt index de985d4db5fa3..26478601fcde8 100644 --- a/doc/source/whatsnew/v0.24.0.txt +++ b/doc/source/whatsnew/v0.24.0.txt @@ -147,7 +147,7 @@ MultiIndex I/O ^^^ -- +- Bug in :func:`to_clipboard` which passes r'\t' instead of '\t' to to_csv (:issue:`21385`) - - diff --git a/pandas/io/clipboards.py b/pandas/io/clipboards.py index dcc221ce978b3..21c627c49b074 100644 --- a/pandas/io/clipboards.py +++ b/pandas/io/clipboards.py @@ -99,7 +99,7 @@ def to_clipboard(obj, excel=True, sep=None, **kwargs): # pragma: no cover if excel: try: if sep is None: - sep = r'\t' + sep = '\t' buf = StringIO() # clipboard_set (pyperclip) expects unicode obj.to_csv(buf, sep=sep, encoding='utf-8', **kwargs)