-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Datetime64Formatter not respecting formatter
#13567
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
formatter
self.assertEqual(result, ['2016-01', '2016-02', '2016-03']) | ||
|
||
def test_format_dataframe_column(self): | ||
months = [datetime(2016,1,1), datetime(2016,2,2), datetime(2016,3,3)] |
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.
this last test goes with all of the test_to_string*
tests.
@@ -4161,6 +4161,21 @@ def test_dates_display(self): | |||
self.assertEqual(result[1].strip(), "NaT") | |||
self.assertEqual(result[4].strip(), "2013-01-01 09:00:00.000000004") | |||
|
|||
def test_datetime64formatter(self): | |||
x = Series([datetime(2016,1,1), datetime(2016,2,2), datetime(2016,3,3)]) |
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.
add a test where to_html are tested as well
Current coverage is 84.34%@@ master #13567 diff @@
==========================================
Files 138 138
Lines 51155 51135 -20
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 43130 43132 +2
+ Misses 8025 8003 -22
Partials 0 0
|
lgtm. |
@@ -528,3 +528,5 @@ Bug Fixes | |||
|
|||
- Bug in ``Categorical.remove_unused_categories()`` changes ``.codes`` dtype to platform int (:issue:`13261`) | |||
- Bug in ``groupby`` with ``as_index=False`` returns all NaN's when grouping on multiple columns including a categorical one (:issue:`13204`) | |||
|
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.
note the reason we leave space in the bug fix section is to avoid conflicts (IOW put up higher in a blank space). @jorisvandenbossche you prob want to move on merge.
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.
thanks for the tip, added blank lines before my bugfix entry. hope that helps with the merge.
…output for df.to_string, df.to_html methods added tests for time of day formatting and df.to_html added test for formatters kw for df.to_latex add whatsnew entry move whatsnew entry higher up
@haleemur Merged, thanks a lot! (I moved the whatsnew note to 0.19.0, as master is now targeted for that) |
- [x] closes pandas-dev#10690 - [x] tests added / passed - [x] passes ``git diff upstream/master | flake8 --diff`` - [x] whatsnew entry the Datetime64Formatter class did not accept a `formatter` argument, so custom formatters passed in through `df.to_string` or `df.to_html` were silently ignored. Author: Haleemur Ali <[email protected]> This patch had conflicts when merged, resolved by Committer: Joris Van den Bossche <[email protected]> Closes pandas-dev#13567 from haleemur/fix/dt64_outputformat and squashes the following commits: 8d84283 [Haleemur Ali] fix bug in Datetime64Formatter, which affected custom date formatted output for df.to_string, df.to_html methods
git diff upstream/master | flake8 --diff
the Datetime64Formatter class did not accept a
formatter
argument, so custom formatters passed in throughdf.to_string
ordf.to_html
were silently ignored.