-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Bug fix - extension array with 2d datetime64 #46140
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
Bug fix - extension array with 2d datetime64 #46140
Conversation
…b.com/weikhor/pandas into bug_ExtensionArray_with_2D_datetime64
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.
does this change user visible formatting or just with the internal formatters?
|
Hi, I am still stuck in the PR. Need more time. |
…b.com/weikhor/pandas into bug_ExtensionArray_with_2D_datetime64
@jbrockmendel ok here? @weikhor if you can merge master |
will take another look today or tomorrow |
nested_formatter = GenericArrayFormatter(fmt_values) | ||
return list(nested_formatter.get_result()) | ||
|
||
return list(fmt_values) |
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.
why is anything necessary between L1630-L1640? we know we have DatetimeIndex which is 1D.
@@ -3158,6 +3158,97 @@ def format_func(x): | |||
result = formatter.get_result() | |||
assert result == ["10:10", "12:12"] | |||
|
|||
def test_datetime64formatter_2d_array(self): | |||
# GH#38390 | |||
x = date_range("2018-01-01", periods=10, freq="H").to_numpy() |
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.
nitpick: pls avoid 1-letter variable names. for date_range i like "dti"
|
||
values = self.values | ||
if not isinstance(values, DatetimeIndex): | ||
values = DatetimeIndex(values) |
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.
OK, so there is a deeper bug here in that DatetimeIndex(values) isn't raising when passed a 2D array.
@@ -1621,18 +1621,23 @@ def __init__( | |||
|
|||
def _format_strings(self) -> list[str]: | |||
"""we by definition have DO NOT have a TZ""" | |||
values = self.values |
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.
what is the scenario in which we get here with non-1D values? could we just assert 1d-ness at the top and not worry about the rest?
Hi It is difficult for me to answer questions provided. I need more time. |
I close this since I stuck this for long time. I get simpler task. Thank for review. |
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.