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

pd.Series.to_string(index=False) behavior changed to include leading spaces #28538

Closed
dauntilus opened this issue Sep 19, 2019 · 3 comments
Closed

Comments

@dauntilus
Copy link

This is a change in behavior between 0.23 and 0.25.

On 0.23.0

In [10]: s=pd.Series(['a','b','c'])
       : s.to_string(index=False)
Out[10]: 'a\nb\nc'

On 0.25.0

In [2]: s=pd.Series(['a','b','c'])
      : s.to_string(index=False)
Out[2]: ' a\n b\n c'

Particularly strange with a series of length 1

In [8]: s=pd.Series(['a'])
      : s.to_string(index=False)
Out[8]: ' a'

There is always exactly 1 leading space regardless of how many characters the index would have taken. The same behavior appears in DataFrame.to_string.

Is this an intended change in behavior? I'm happy to look into identifying the cause if it is not intended.

@TomAugspurger
Copy link
Contributor

Looks like #24980.

Stalled PR at #25000

Summary at #25000 (comment).

So an unexpectedly tricky issue. Let us know if you're interested in working on it.

@dauntilus
Copy link
Author

It looks like @charlesdong1991 has done most of the work already on this and he's still contributing to Pandas recently. If he has the time to finish his PR I'll defer to him but otherwise I'm fine with taking that on.

@charlesdong1991
Copy link
Member

@dauntilus I just read through your issue and my stalled PR, I could not recall exactly, but I think it was stalled because I was away for computer for several months for personal reason. Anyway, although i am still active contributing, if you are into working on it, and it will be my pleasure if you could get some inspirations from my stalled PR and continue! So go ahead if you want to fix the issue for Pandas! otherwise let me know, i will reopen it then.

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

No branches or pull requests

3 participants