Skip to content

Commit f0a9480

Browse files
committed
it works!
1 parent 487cee0 commit f0a9480

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

pandas/hashtable.pyx

+5-8
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ PyDateTime_IMPORT
2828
cdef extern from "Python.h":
2929
int PySlice_Check(object)
3030

31-
3231
def list_to_object_array(list obj):
3332
'''
3433
Convert list to object ndarray. Seriously can't believe I had to write this
@@ -108,14 +107,12 @@ cdef class Int64Vector(Vector):
108107

109108
cdef inline void append(self, int64_t x) nogil:
110109

111-
with nogil:
112-
113-
if self.needs_resize():
114-
with gil:
115-
self.resize()
110+
if self.needs_resize():
111+
with gil:
112+
self.resize()
116113

117-
self.data[self.n] = x
118-
self.n += 1
114+
self.data[self.n] = x
115+
self.n += 1
119116

120117
cdef class Float64Vector(Vector):
121118

vb_suite/gil.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
from pandas.util.testing import test_parallel
99
1010
N = 1000000
11-
ngroups = 100
11+
ngroups = 1000
1212
1313
def get_test_data(ngroups=100, n=N):
1414
unique_groups = range(ngroups)
15-
arr = np.asarray(np.tile(unique_groups, n / ngroups), dtype=object)
15+
arr = np.asarray(np.tile(unique_groups, n / ngroups), dtype='int64')
1616
1717
if len(arr) < n:
1818
arr = np.asarray(list(arr) + unique_groups[:n - len(arr)],
19-
dtype=object)
19+
dtype='int64')
2020
2121
random.shuffle(arr)
2222
return arr
@@ -26,10 +26,8 @@ def get_test_data(ngroups=100, n=N):
2626
'data1' : np.random.randn(N),
2727
'data2' : np.random.randn(N)})
2828
29-
grp = df.groupby('key1')['data1']
30-
3129
def f():
32-
grp.sum()
30+
df.groupby('key1')['data1'].sum()
3331
3432
# run consecutivily
3533
def g2():

0 commit comments

Comments
 (0)