diff --git a/fletcher/base.py b/fletcher/base.py index 3f1eeea1..d9e24b56 100644 --- a/fletcher/base.py +++ b/fletcher/base.py @@ -205,6 +205,29 @@ def __array__(self, copy=None): """ return pa.column("dummy", self.data).to_pandas().values + @property + def size(self): + """ + Number of elements in this array. + + Returns + ------- + size : int + """ + # type: () -> int + return len(self.data) + + @property + def shape(self): + # type: () -> Tuple[int] + # This may be patched by pandas to support pseudo-2D operations. + return (self.size,) + + @property + def ndim(self): + # type: () -> int + return len(self.shape) + def __len__(self): """ Length of this array @@ -214,7 +237,7 @@ def __len__(self): length : int """ # type: () -> int - return len(self.data) + return self.shape[0] @classmethod def _concat_same_type(cls, to_concat): @@ -481,13 +504,6 @@ def nbytes(self): size += buf.size return size - @property - def size(self): - """ - return the number of elements in the underlying data - """ - return len(self.data) - @property def base(self): """