Skip to content

Commit 20b8094

Browse files
committed
BLD: msvc fix (hopefully) + start resample benchmarks later in 2012
1 parent a6d89d1 commit 20b8094

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

pandas/src/ujson/python/objToJSON.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,10 @@ enum PANDAS_FORMAT
100100

101101
void initObjToJSON(void)
102102
{
103+
PyObject *mod_frame;
103104
PyDateTime_IMPORT;
104105

105-
PyObject *mod_frame = PyImport_ImportModule("pandas.core.frame");
106+
mod_frame = PyImport_ImportModule("pandas.core.frame");
106107
if (mod_frame)
107108
{
108109
cls_dataframe = PyObject_GetAttrString(mod_frame, "DataFrame");
@@ -941,7 +942,7 @@ char** NpyArr_encodeLabels(PyArrayObject* labels, JSONObjectEncoder* enc, npy_in
941942
for (i = 0; i < num; i++)
942943
{
943944
item = getitem(dataptr, labels);
944-
if (!item)
945+
if (!item)
945946
{
946947
NpyArr_freeLabels(ret, num);
947948
ret = 0;

vb_suite/timeseries.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
def date_range(start=None, end=None, periods=None, freq=None):
1313
return DateRange(start, end, periods=periods, offset=freq)
1414
15+
if hasattr(Series, 'convert'):
16+
Series.resample = Series.convert
17+
1518
ts = Series(np.random.randn(N), index=rng)
1619
"""
1720

@@ -39,11 +42,13 @@ def date_range(start=None, end=None, periods=None, freq=None):
3942
4043
"""
4144

42-
timeseries_1min_5min_ohlc = Benchmark("ts[:10000].convert('5min', how='ohlc')",
43-
common_setup)
45+
timeseries_1min_5min_ohlc = Benchmark("ts[:10000].resample('5min', how='ohlc')",
46+
common_setup,
47+
start_date=datetime(2012, 5, 1))
4448

45-
timeseries_1min_5min_mean = Benchmark("ts[:10000].convert('5min', how='mean')",
46-
common_setup)
49+
timeseries_1min_5min_mean = Benchmark("ts[:10000].resample('5min', how='mean')",
50+
common_setup,
51+
start_date=datetime(2012, 5, 1))
4752

4853
#----------------------------------------------------------------------
4954
# Irregular alignment

0 commit comments

Comments
 (0)