71
71
return arr.asobject
72
72
else:
73
73
return np.array(arr, dtype=np.object_)
74
-
75
74
"""
76
75
77
76
@@ -93,7 +92,6 @@ def take_1d_%(name)s_%(dest)s(ndarray[%(c_type_in)s] values,
93
92
out[i] = fv
94
93
else:
95
94
out[i] = %(preval)svalues[idx]%(postval)s
96
-
97
95
"""
98
96
99
97
inner_take_2d_axis0_template = """\
@@ -135,7 +133,6 @@ def take_1d_%(name)s_%(dest)s(ndarray[%(c_type_in)s] values,
135
133
else:
136
134
for j from 0 <= j < k:
137
135
out[i, j] = %(preval)svalues[idx, j]%(postval)s
138
-
139
136
"""
140
137
141
138
take_2d_axis0_template = """\
@@ -242,7 +239,6 @@ def take_2d_multi_%(name)s_%(dest)s(ndarray[%(c_type_in)s, ndim=2] values,
242
239
out[i, j] = fv
243
240
else:
244
241
out[i, j] = %(preval)svalues[idx, idx1[j]]%(postval)s
245
-
246
242
"""
247
243
248
244
@@ -333,7 +329,6 @@ def backfill_%(name)s(ndarray[%(c_type)s] old, ndarray[%(c_type)s] new,
333
329
cur = prev
334
330
335
331
return indexer
336
-
337
332
"""
338
333
339
334
@@ -397,7 +392,6 @@ def pad_%(name)s(ndarray[%(c_type)s] old, ndarray[%(c_type)s] new,
397
392
cur = next
398
393
399
394
return indexer
400
-
401
395
"""
402
396
403
397
pad_1d_template = """@cython.boundscheck(False)
@@ -432,7 +426,6 @@ def pad_inplace_%(name)s(ndarray[%(c_type)s] values,
432
426
else:
433
427
fill_count = 0
434
428
val = values[i]
435
-
436
429
"""
437
430
438
431
pad_2d_template = """@cython.boundscheck(False)
@@ -657,7 +650,6 @@ def is_monotonic_%(name)s(ndarray[%(c_type)s] arr, bint timelike):
657
650
result[index[i]] = i
658
651
659
652
return result
660
-
661
653
"""
662
654
663
655
groupby_template = """@cython.wraparound(False)
@@ -687,7 +679,6 @@ def groupby_%(name)s(ndarray[%(c_type)s] index, ndarray labels):
687
679
result[key] = [idx]
688
680
689
681
return result
690
-
691
682
"""
692
683
693
684
group_last_template = """@cython.wraparound(False)
@@ -1286,8 +1277,6 @@ def group_count_%(name)s(ndarray[%(dest_type2)s, ndim=2] out,
1286
1277
for i in range(ncounts):
1287
1278
for j in range(K):
1288
1279
out[i, j] = nobs[i, j]
1289
-
1290
-
1291
1280
"""
1292
1281
1293
1282
group_count_bin_template = """@cython.wraparound(False)
@@ -1322,9 +1311,8 @@ def group_count_bin_%(name)s(ndarray[%(dest_type2)s, ndim=2] out,
1322
1311
for i in range(ngroups):
1323
1312
for j in range(K):
1324
1313
out[i, j] = nobs[i, j]
1325
-
1326
-
1327
1314
"""
1315
+
1328
1316
# add passing bin edges, instead of labels
1329
1317
1330
1318
@@ -1788,7 +1776,6 @@ def arrmap_%(name)s(ndarray[%(c_type)s] index, object func):
1788
1776
result[i] = func(index[i])
1789
1777
1790
1778
return maybe_convert_objects(result)
1791
-
1792
1779
"""
1793
1780
1794
1781
#----------------------------------------------------------------------
@@ -1840,7 +1827,6 @@ def left_join_indexer_unique_%(name)s(ndarray[%(c_type)s] left,
1840
1827
indexer[i] = -1
1841
1828
i += 1
1842
1829
return indexer
1843
-
1844
1830
"""
1845
1831
1846
1832
# @cython.wraparound(False)
@@ -1947,7 +1933,6 @@ def left_join_indexer_%(name)s(ndarray[%(c_type)s] left,
1947
1933
j += 1
1948
1934
1949
1935
return result, lindexer, rindexer
1950
-
1951
1936
"""
1952
1937
1953
1938
@@ -2043,7 +2028,6 @@ def inner_join_indexer_%(name)s(ndarray[%(c_type)s] left,
2043
2028
j += 1
2044
2029
2045
2030
return result, lindexer, rindexer
2046
-
2047
2031
"""
2048
2032
2049
2033
@@ -2175,7 +2159,6 @@ def outer_join_indexer_%(name)s(ndarray[%(c_type)s] left,
2175
2159
j += 1
2176
2160
2177
2161
return result, lindexer, rindexer
2178
-
2179
2162
"""
2180
2163
2181
2164
outer_join_template = """@cython.wraparound(False)
@@ -2273,7 +2256,6 @@ def outer_join_indexer_%(name)s(ndarray[%(c_type)s] left,
2273
2256
count += 1
2274
2257
2275
2258
return result, lindexer, rindexer
2276
-
2277
2259
"""
2278
2260
2279
2261
# ensure_dtype functions
@@ -2287,7 +2269,6 @@ def outer_join_indexer_%(name)s(ndarray[%(c_type)s] left,
2287
2269
return arr.astype(np.%(dtype)s)
2288
2270
else:
2289
2271
return np.array(arr, dtype=np.%(dtype)s)
2290
-
2291
2272
"""
2292
2273
2293
2274
ensure_functions = [
@@ -2362,6 +2343,7 @@ def generate_put_template(template, use_ints=True, use_floats=True,
2362
2343
'dest_type2' : dest_type ,
2363
2344
'dest_dtype' : dest_dtype }
2364
2345
output .write (func )
2346
+ output .write ("\n " )
2365
2347
return output .getvalue ()
2366
2348
2367
2349
def generate_put_min_max_template (template , use_ints = True , use_floats = True ,
@@ -2394,6 +2376,7 @@ def generate_put_min_max_template(template, use_ints=True, use_floats=True,
2394
2376
'nan_val' : nan_val ,
2395
2377
'inf_val' : inf_val }
2396
2378
output .write (func )
2379
+ output .write ("\n " )
2397
2380
return output .getvalue ()
2398
2381
2399
2382
def generate_put_selection_template (template , use_ints = True , use_floats = True ,
@@ -2426,6 +2409,7 @@ def generate_put_selection_template(template, use_ints=True, use_floats=True,
2426
2409
'dest_type2' : dest_type ,
2427
2410
'nan_val' : nan_val }
2428
2411
output .write (func )
2412
+ output .write ("\n " )
2429
2413
return output .getvalue ()
2430
2414
2431
2415
def generate_take_template (template , exclude = None ):
@@ -2464,6 +2448,7 @@ def generate_take_template(template, exclude=None):
2464
2448
'preval' : preval , 'postval' : postval ,
2465
2449
'can_copy' : 'True' if can_copy else 'False' }
2466
2450
output .write (func )
2451
+ output .write ("\n " )
2467
2452
return output .getvalue ()
2468
2453
2469
2454
def generate_from_template (template , exclude = None ):
@@ -2486,6 +2471,7 @@ def generate_from_template(template, exclude=None):
2486
2471
'dtype' : dtype ,
2487
2472
'raise_on_na' : 'False' if can_hold_na else 'True' }
2488
2473
output .write (func )
2474
+ output .write ("\n " )
2489
2475
return output .getvalue ()
2490
2476
2491
2477
put_2d = [diff_2d_template ]
0 commit comments