-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
ENH : GH11729 added index parameter in series to_string #11750
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
Conversation
@@ -126,14 +126,15 @@ def to_string(self): | |||
class SeriesFormatter(object): | |||
|
|||
def __init__(self, series, buf=None, length=True, header=True, | |||
na_rep='NaN', name=False, float_format=None, dtype=True, | |||
max_rows=None): | |||
na_rep='NaN', index=True, name=False, float_format=None, |
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.
are these in the same order as the DataFrameFormatter
?
pls add a whatsnew note (enhancements is ok) |
@varun-kr can you update |
dad608b
to
9afd92e
Compare
@jreback Updated code . Please review . It seems that there is some problem with the build . |
just push again; the option tests occasionally fail |
9afd92e
to
6e29159
Compare
@jreback Done. |
s= Series([1, 2, 3, 4]) | ||
result = s.to_string(index=False) | ||
expected = (u(' 1\n') + | ||
' 2\n' + |
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.
@jorisvandenbossche does this look right? (e.g. I know we add a space, but seems odd with no index....)
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.
It seems more logical to me that the space is not there if no index is added.
But, DataFrame.to_string
also does this:
In [13]: print df.to_string()
a b c
0 1 b 1
1 1 b 2
2 2 b 3
3 2 a 4
In [14]: print df.to_string(index=False)
a b c
1 b 1
1 b 2
2 b 3
2 a 4
Of course not necessarily a reason to do it here as well
ENH : GH11729 added index parameter in series to_string
@varun-kr thanks! can you open an issue to re-examine whether passing |
Fixes #11729
Please Review .