We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fa26bce commit 6a3f030Copy full SHA for 6a3f030
pandas/core/arrays/base.py
@@ -407,6 +407,13 @@ def shape(self) -> Tuple[int, ...]:
407
"""
408
return (len(self),)
409
410
+ @property
411
+ def size(self) -> int:
412
+ """
413
+ The number of elements in the array.
414
415
+ return np.prod(self.shape)
416
+
417
@property
418
def ndim(self) -> int:
419
pandas/tests/extension/base/interface.py
@@ -19,6 +19,9 @@ class BaseInterfaceTests(BaseExtensionTests):
19
def test_len(self, data):
20
assert len(data) == 100
21
22
+ def test_size(self, data):
23
+ assert data.size == 100
24
25
def test_ndim(self, data):
26
assert data.ndim == 1
27
0 commit comments