Skip to content

Commit

Permalink
Add IntegerArray.size, fix pandas-dev#25580.
Browse files Browse the repository at this point in the history
Signed-off-by: HE, Tao <sighingnow@gmail.com>
  • Loading branch information
sighingnow committed Mar 7, 2019
1 parent 74a9ae3 commit 1a27d2f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pandas/core/arrays/integer.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,10 @@ def __setitem__(self, key, value):
def __len__(self):
return len(self._data)

@property
def size(self):
return self._data.size

@property
def nbytes(self):
return self._data.nbytes + self._mask.nbytes
Expand Down
10 changes: 10 additions & 0 deletions pandas/tests/resample/test_datetime_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,16 @@ def test_resample_basic(series, closed, expected):
result = s.resample('5min', closed=closed, label='right').mean()
assert_series_equal(result, expected)

def test_resample_integerarray():
# resample on IntegerArray
ts = pd.Series(range(9),
index=pd.date_range('1/1/2000', periods=9, freq='T'),
dtype='Int64')
result = ts.resample('3T').sum()
expected = Series([3, 12, 21],
index=pd.date_range('1/1/2000', periods=3, freq='3T'),
dtype="Int64")
assert_series_equal(result, expected)

def test_resample_basic_grouper(series):
s = series
Expand Down

0 comments on commit 1a27d2f

Please sign in to comment.