Skip to content

Commit 094aee0

Browse files
committed
BUG: close #816, fix exception thrown on np.diff
1 parent 5505aa1 commit 094aee0

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

RELEASE.rst

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ pandas 0.7.1
4343
- Fixed groupby corner case when passing dictionary grouper and as_index is
4444
False (#819)
4545
- Fixed bug whereby bool array sometimes had object dtype (#820)
46+
- Fix exception thrown on np.diff (#816)
4647

4748
pandas 0.7.0
4849
============

pandas/core/series.py

+2
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,8 @@ def ix(self):
369369

370370
def __getitem__(self, key):
371371
try:
372+
if type(key) == tuple and len(key)==1:
373+
key = key[0]
372374
return self.index.get_value(self, key)
373375
except InvalidIndexError:
374376
pass

pandas/tests/test_series.py

+5
Original file line numberDiff line numberDiff line change
@@ -911,6 +911,11 @@ def test_cummax(self):
911911

912912
self.assert_(np.array_equal(result, expected))
913913

914+
def test_npdiff(self):
915+
s = Series(np.arange(5))
916+
r = np.diff(s)
917+
assert_series_equal(Series([nan, 0, 0, 0, nan]), r)
918+
914919
def _check_stat_op(self, name, alternate, check_objects=False):
915920
from pandas import DateRange
916921
import pandas.core.nanops as nanops

0 commit comments

Comments
 (0)