Skip to content

pandas.DataFrame.to_clipboard with excel option does not parse into columns with 0.23 #21104

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
kentmaxwell opened this issue May 17, 2018 · 3 comments · Fixed by #21111
Closed
Labels
Bug Regression Functionality that used to work in a prior pandas version
Milestone

Comments

@kentmaxwell
Copy link

kentmaxwell commented May 17, 2018

Problem description

With Version 0.23 of pandas, the function .to_clipboard(), with the option excel=True no longer produces a copy of the dataframe which is Excel friendly when pasting the data into an Excel worksheet. All the data comes into a single column in the Excel workbook. Previously, the data would parse across all the columns.

The code that demonstrates this situation is:

Import pandas as pd
df = pd.DataFrame(np.random.randn(5,10))

df.to_clipboard(excel=True)

The output in excel ends up looking like this:

https://www.screencast.com/t/DPTOukwE

Output of pd.show_versions()

INSTALLED VERSIONS

commit: None
python: 3.6.5.final.0
python-bits: 64
OS: Darwin
OS-release: 17.5.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8

pandas: 0.23.0
pytest: 3.5.1
pip: 10.0.1
setuptools: 39.1.0
Cython: 0.28.2
numpy: 1.13.3
scipy: 1.1.0
pyarrow: None
xarray: None
IPython: 6.4.0
sphinx: 1.7.4
patsy: 0.5.0
dateutil: 2.7.3
pytz: 2018.4
blosc: None
bottleneck: 1.2.1
tables: 3.4.3
numexpr: 2.6.5
feather: None
matplotlib: 2.2.2
openpyxl: 2.5.3
xlrd: 1.1.0
xlwt: 1.2.0
xlsxwriter: 1.0.4
lxml: 4.2.1
bs4: 4.6.0
html5lib: 1.0.1
sqlalchemy: 1.2.7
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None

@WillAyd
Copy link
Member

WillAyd commented May 17, 2018

Quick debug shows me that what was previously tab delimited is now showing up with spaces, hence why the paste to Excel does not work.

Investigation / PRs are welcome!

@chris-b1 chris-b1 added Bug Regression Functionality that used to work in a prior pandas version labels May 17, 2018
@chris-b1 chris-b1 added this to the 0.23.1 milestone May 17, 2018
@chris-b1
Copy link
Contributor

Ugh, sorry about this, I use this all the time and should have caught it in the RC. I'll eventually get this, or please feel to take look first!

@jcjf
Copy link
Contributor

jcjf commented Jun 28, 2018

The problem was introduced in #18968, when '\t' started becoming r'\t' in pandas.io.clipboards.py.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Regression Functionality that used to work in a prior pandas version
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants