Fix order parameters and add decimal to to_string by thoo · Pull Request #23614 · pandas-dev/pandas (original) (raw)
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 andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation15 Commits14 Checks0 Files changed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})
- closes CLN: Consistency of arguments in to_html and to_string #23612
- tests added / passed
- passes
git diff upstream/master -u -- "*.py" | flake8 --diff
- whatsnew entry
Add an extra argument:decimal
topandas.DataFrame.to_string
.
Looks quite nice.
I think it good be good to have one test to see that decimal
is working in to_string
, and then we need to add to the whatsnew two entries, one for the addition of decimal, and another one for the argument resorting.
@datapythonista Please let me know the two entries are not in the right place in whatnews
file.
@@ -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`) |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you use a :func:
ref here
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
say to be consistent with each other
@@ -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]}) |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add the issue number
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small thing, but I think we consistently use the format GH 23614
.
@gfyoung I think you changed some in a recent PR, can you confirm?
@jreback All checks are passed. Could you re-review this ? Thanks.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, just two minor things
@@ -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`) |
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?
@@ -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]}) |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small thing, but I think we consistently use the format GH 23614
.
@gfyoung I think you changed some in a recent PR, can you confirm?
@@ -961,6 +962,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`). |
- :func:The order of the arguments of `DataFrame.to_html` and `DataFrame.to_string` is rearranged to be consistent with each other. (:issue:`23614`) |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is malformed here, you need the :func:
to go with the DataFrame.to_html and .to_string (separate ones)
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. Done.
tm9k1 pushed a commit to tm9k1/pandas that referenced this pull request
thoo deleted the to_html-to_string branch
Pingviinituutti pushed a commit to Pingviinituutti/pandas that referenced this pull request
Pingviinituutti pushed a commit to Pingviinituutti/pandas that referenced this pull request