Skip to content

Commit b3f2133

Browse files
committed
BUG: fixes to bugs raised by moving to Cython 0.16rc2
1 parent fc56b64 commit b3f2133

File tree

5 files changed

+14
-9
lines changed

5 files changed

+14
-9
lines changed

pandas/core/groupby.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ def get_group_levels(self):
640640
}
641641

642642
_name_functions = {
643-
'ohlc' : lambda *args: ['open', 'low', 'high', 'close']
643+
'ohlc' : lambda *args: ['open', 'high', 'low', 'close']
644644
}
645645

646646
def aggregate(self, values, how):

pandas/src/groupby.pyx

+4-4
Original file line numberDiff line numberDiff line change
@@ -892,8 +892,8 @@ def group_ohlc(ndarray[float64_t, ndim=2] out,
892892
out[b, 3] = NA
893893
else:
894894
out[b, 0] = vopen
895-
out[b, 1] = vlow
896-
out[b, 2] = vhigh
895+
out[b, 1] = vhigh
896+
out[b, 2] = vlow
897897
out[b, 3] = vclose
898898
b += 1
899899
got_first = 0
@@ -922,8 +922,8 @@ def group_ohlc(ndarray[float64_t, ndim=2] out,
922922
out[b, 3] = NA
923923
else:
924924
out[b, 0] = vopen
925-
out[b, 1] = vlow
926-
out[b, 2] = vhigh
925+
out[b, 1] = vhigh
926+
out[b, 2] = vlow
927927
out[b, 3] = vclose
928928

929929

pandas/src/tseries.pyx

+6-1
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,12 @@ def maybe_booleans_to_slice(ndarray[uint8_t, cast=True] mask):
451451
end = i
452452
finished = 1
453453

454-
return slice(start, end)
454+
if not started:
455+
return slice(0, 0)
456+
if not finished:
457+
return slice(start, None)
458+
else:
459+
return slice(start, end)
455460

456461

457462
@cython.wraparound(False)

pandas/tests/test_timeseries.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ def test_ohlc_5min(self):
239239
def _ohlc(group):
240240
if isnull(group).all():
241241
return np.repeat(np.nan, 4)
242-
return [group[0], group.min(), group.max(), group[-1]]
242+
return [group[0], group.max(), group.min(), group[-1]]
243243

244244
rng = date_range('1/1/2000 00:00:00', '1/1/2000 5:59:50',
245245
freq='10s')
@@ -807,7 +807,7 @@ def test_convert_upsample(self):
807807
self.assertEquals(result[0], s[0])
808808
self.assertEquals(result[-1], s[-1])
809809

810-
def test_convert_olhc(self):
810+
def test_convert_ohlc(self):
811811
s = self.series
812812

813813
grouper = TimeGrouper(Minute(5), closed='right', label='right')

pandas/tests/test_tseries.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ def test_group_ohlc():
420420
def _ohlc(group):
421421
if isnull(group).all():
422422
return np.repeat(np.nan, 4)
423-
return [group[0], group.min(), group.max(), group[-1]]
423+
return [group[0], group.max(), group.min(), group[-1]]
424424

425425
expected = np.array([_ohlc(obj[:6]), _ohlc(obj[6:12]),
426426
_ohlc(obj[12:])])

0 commit comments

Comments
 (0)