-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
REF: use new pytables helper methods to de-duplicate _convert_index #30144
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
REF: use new pytables helper methods to de-duplicate _convert_index #30144
Conversation
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.
looks good about the assertions
@@ -2318,6 +2309,9 @@ def get_atom_coltype(cls, kind: str) -> Type["Col"]: | |||
if kind.startswith("uint"): | |||
k4 = kind[4:] | |||
col_name = f"UInt{k4}Col" | |||
elif kind.startswith("period"): | |||
# we store as integer |
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.
we may have very little coverage for PeriodIndex FYI
# For datetime64tz we need to drop the TZ in tests TODO: why? | ||
dtype_name = data.dtype.name.split("[")[0] | ||
|
||
if data.dtype.kind in ["m", "M"]: |
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.
use needs_i8_conversion (followon ok)
# TODO: we used to reshape for the dt64tz case, but no longer | ||
# doing that doesnt seem to break anything. why? | ||
|
||
elif isinstance(data, PeriodIndex): |
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.
can likely use extract_array here
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.
that would give PeriodArray, we need to get i8 back here
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.
right once you have the arrays, then you can simply .view('i8') and you are done (pretty generically)
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 i see what you're saying now. will do on next pass (along with needs_i8 mentioned above)
…f-pytables-convert_index
looks good. if you can do follows as indicated above when you have a chance. |
The assertions in here are intended to be temporary. Once reviewers are convinced this is accurate, then the assertions can be removed and a bunch of these blocks can be condensed down to share code.
The new helper func _get_data_and_dtype_name is also going to be used later to pre-empt the need for the state-altering
get_data
method.