-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Fix order parameters and add decimal to to_string #23614
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 4 commits
13b3fcd
c41c1ea
910cfea
831aa90
b87dc8c
e19bf6f
ef872e9
87297cd
895f8cd
7186aaf
21fa21e
16678b8
2bb90d4
ddf42c7
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 |
---|---|---|
|
@@ -20,7 +20,8 @@ New features | |
the user to override the engine's default behavior to include or omit the | ||
dataframe's indexes from the resulting Parquet file. (:issue:`20768`) | ||
- :meth:`DataFrame.corr` and :meth:`Series.corr` now accept a callable for generic calculation methods of correlation, e.g. histogram intersection (:issue:`22684`) | ||
|
||
- :func:`DataFrame.to_string` now accepts ``decimal`` as an argument, allowing | ||
the user to use a decimal separator. (:issue:`23614`) | ||
|
||
.. _whatsnew_0240.enhancements.extension_array_operators: | ||
|
||
|
@@ -945,6 +946,7 @@ Other API Changes | |
- :class:`DateOffset` attribute `_cacheable` and method `_should_cache` have been removed (:issue:`23118`) | ||
- Comparing :class:`Timedelta` to be less or greater than unknown types now raises a ``TypeError`` instead of returning ``False`` (:issue:`20829`) | ||
- :meth:`Index.hasnans` and :meth:`Series.hasnans` now always return a python boolean. Previously, a python or a numpy boolean could be returned, depending on circumstances (:issue:`23294`). | ||
- The order of the arguments of `DataFrame.to_html` and `DataFrame.to_string` is rearranged. (:issue:`23614`) | ||
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 use a 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. say to be consistent with each other |
||
|
||
.. _whatsnew_0240.deprecations: | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1451,6 +1451,11 @@ def test_to_string_format_na(self): | |
'4 4.0 bar') | ||
assert result == expected | ||
|
||
def test_to_string_decimal(self): | ||
df = DataFrame({'A': [6.0, 3.1, 2.2]}) | ||
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 add the issue number 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. Small thing, but I think we consistently use the format @gfyoung I think you changed some in a recent PR, can you confirm? |
||
expected = ' A\n0 6,0\n1 3,1\n2 2,2' | ||
assert df.to_string(decimal=',') == expected | ||
|
||
def test_to_string_line_width(self): | ||
df = DataFrame(123, lrange(10, 15), lrange(30)) | ||
s = df.to_string(line_width=80) | ||
|
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.
more than
to use
as decimal separator, if I understood correctly, it'll allow the user to specify which decimal separator should be used in the output. Isn't it?