-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
ENH: add in extension dtype registry #21185
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 1 commit
4b132cf
90fccb0
80e15fd
1c3d023
4b05a1c
9cfbc07
72e1010
59b3510
07d1038
7dbd2f3
7a2cb6a
96d5d09
5119672
e22d4c7
7cc1a0a
930cec5
bd5dcd3
407d7b3
9084906
f560ea1
5fabd51
d2c91d7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -92,7 +92,7 @@ def _from_sequence(cls, scalars, copy=False): | |
scalars : Sequence | ||
Each element will be an instance of the scalar type for this | ||
array, ``cls.dtype.type``. | ||
copy : boolean, default True | ||
copy : boolean, default False | ||
if True, copy the underlying data | ||
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. What does this exactly mean? 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. same guarantee with copy we have already, if its True, then copy if possible. 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 that to the docstring? |
||
Returns | ||
------- | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,13 +9,14 @@ | |
|
||
|
||
class Registry(object): | ||
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. Without looking at the uses yet, could we simplify this a by just allowing string lookup? Ideally, 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. I think the current code also supports finding the dtype for eg 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. Oh, and I suppose we want that to support |
||
""" Registry for dtype inference | ||
""" | ||
Registry for dtype inference | ||
|
||
We can directly construct dtypes in pandas_dtypes if they are | ||
a type; the registry allows us to register an extension dtype | ||
to try inference from a string or a dtype class | ||
The registry allows one to map a string repr of a extension | ||
dtype to an extenstion dtype. | ||
|
||
These are tried in order for inference. | ||
Multiple extension types can be registered. | ||
These are tried in order. | ||
|
||
Examples | ||
-------- | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -788,6 +788,7 @@ def test_registry(dtype): | |
[('int64', None), | ||
('interval', IntervalDtype()), | ||
('interval[int64]', IntervalDtype()), | ||
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 replace this (or also add) one that is not the default? 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. (although that is maybe covered with the period or datetime64 one below. Is |
||
('interval[datetime64[ns]]', IntervalDtype('datetime64[ns]')), | ||
('category', CategoricalDtype()), | ||
('period[D]', PeriodDtype('D')), | ||
('datetime64[ns, US/Eastern]', DatetimeTZDtype('ns', 'US/Eastern'))]) | ||
|
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.
'the dtype' -> ExtensionDtype has gained :meth:`ExtensionDtype.construct_array_type`