-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
Array Interface and Categorical internals Refactor #19268
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
2ef5216
57e8b0f
01bd42f
ce81706
87a70e3
8c61886
cb41803
65d5a61
57c749b
6736b0f
e4acb59
0e9337b
df68f3b
2746a43
34d2b99
a484d61
04b2e72
df0fa12
e778053
d15a722
b5f736d
240e8f6
f9b0b49
7913186
df18c3b
ab2f045
520876f
4dfa39c
e252103
7110b2a
c59dca0
fc688a5
fbc8466
030bb19
0f4c2d7
f9316e0
9c06b13
7d2cf9c
afae8ae
cd0997e
1d6eb04
92aed49
34134f2
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 |
|---|---|---|
|
|
@@ -20,9 +20,9 @@ class ExtensionArray(object): | |
|
|
||
| **Restrictions on your class constructor** | ||
|
|
||
| * Your class should be able to be constructed with instances of | ||
| our class, i.e. ``ExtensionArray(extension_array)`` should returns | ||
| an instance. | ||
| * Extension arrays should be able to be constructed with instances of | ||
| the class, i.e. ``ExtensionArray(extension_array)`` should return | ||
| an instance, not error. | ||
| """ | ||
| # ------------------------------------------------------------------------ | ||
| # Must be a Sequence | ||
|
|
@@ -69,10 +69,6 @@ def __len__(self): | |
| # ------------------------------------------------------------------------ | ||
| # Required attributes | ||
| # ------------------------------------------------------------------------ | ||
| @property | ||
| def base(self): | ||
| """The base array I am a view of. None by default.""" | ||
|
|
||
| @property | ||
| @abc.abstractmethod | ||
| def dtype(self): | ||
|
|
@@ -94,7 +90,11 @@ def ndim(self): | |
| @abc.abstractmethod | ||
| def nbytes(self): | ||
| # type: () -> int | ||
|
Member
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. Type comments come before the docstring: http://mypy.readthedocs.io/en/latest/python2.html |
||
| """The number of bytes needed to store this object in memory.""" | ||
| """The number of bytes needed to store this object in memory. | ||
|
|
||
| If this is expensive to compute, return an approximate lower bound | ||
| on the number of bytes needed. | ||
| """ | ||
|
|
||
| # ------------------------------------------------------------------------ | ||
| # Additional Methods | ||
|
|
@@ -127,6 +127,8 @@ def take(self, indexer, allow_fill=True, fill_value=None): | |
| Notes | ||
| ----- | ||
| This should follow pandas' semantics where -1 indicates missing values. | ||
| Positions where indexer is ``-1`` should be filled with the missing | ||
| value for this type. | ||
|
Member
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. Let's strongly consider exposing a helper function to make this easier to write, or at least an example of what this would look like (we can save this for later). It's not obvious how to write this with NumPy.
Contributor
Author
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 added an example that I hope gets things correct for an extension type backed by a NumPy structured array. One trouble with this providing a helper function is that we don't know much about how the extension array is actually storing the data. Although, we could rely on the assumption that the underlying storage is convertible to a NumPy array, and proceed from there. Though this would perhaps be sub-optimal for many extension arrays.
Member
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. For GeometryArray, we have followed the same idea the write
Contributor
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. this is fine as it is a pandas standard. |
||
|
|
||
| This is called by ``Series.__getitem__``, ``.loc``, ``iloc``, when the | ||
| indexer is a sequence of 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.
this formatting is a bit odd here