@@ -2424,59 +2424,9 @@ cdef cnp.ndarray[object] _concat_date_cols_numpy(tuple date_cols,
2424
2424
return result
2425
2425
2426
2426
2427
- @ cython.wraparound (False )
2428
- @ cython.boundscheck (False )
2429
- cdef cnp.ndarray[object ] _concat_date_cols_sequence(tuple date_cols,
2430
- Py_ssize_t rows_count,
2431
- Py_ssize_t col_count,
2432
- bint keep_trivial_numbers):
2433
- """
2434
- Concatenates elements from sequences into strings.
2435
-
2436
- Parameters
2437
- ----------
2438
- date_cols : tuple of sequences
2439
- rows_count : Py_ssize_t
2440
- count of elements from sequences that will be concatenated
2441
- col_count : Py_ssize_t
2442
- count of sequences whose elements will be concatenated
2443
- keep_trivial_numbers : bool, default False
2444
- if True and len(date_cols) == 1, then
2445
- conversion (to string from integer/float zero) is not performed
2446
-
2447
- Returns
2448
- -------
2449
- arr_of_rows : ndarray (dtype=object)
2450
- """
2451
- cdef:
2452
- Py_ssize_t col_idx, row_idx
2453
- list list_to_join
2454
- cnp.ndarray[object ] result
2455
- object [:] result_view
2456
-
2457
- result = np.zeros(rows_count, dtype = object )
2458
-
2459
- # create memoryview of result ndarray - more effecient indexing
2460
- result_view = result
2461
-
2462
- if col_count == 1 :
2463
- for row_idx, item in enumerate (date_cols[0 ]):
2464
- result_view[row_idx] = convert_to_unicode(item,
2465
- keep_trivial_numbers)
2466
- else :
2467
- list_to_join = [None ] * col_count
2468
- for row_idx in range (rows_count):
2469
- for col_idx, array in enumerate (date_cols):
2470
- list_to_join[col_idx] = convert_to_unicode(array[row_idx],
2471
- False )
2472
- result_view[row_idx] = PyUnicode_Join(' ' , list_to_join)
2473
-
2474
- return result
2475
-
2476
-
2477
2427
def _concat_date_cols (tuple date_cols , bint keep_trivial_numbers = True ):
2478
2428
"""
2479
- Concatenates elements from sequences in `date_cols` into strings.
2429
+ Concatenates elements from numpy arrays in `date_cols` into strings.
2480
2430
2481
2431
Parameters
2482
2432
----------
@@ -2506,9 +2456,6 @@ def _concat_date_cols(tuple date_cols, bint keep_trivial_numbers=True):
2506
2456
rows_count = min (len (array) for array in date_cols)
2507
2457
2508
2458
if all (util.is_array(array) for array in date_cols):
2509
- # call specialized function to increase performance
2510
2459
return _concat_date_cols_numpy(date_cols, rows_count, col_count,
2511
2460
keep_trivial_numbers)
2512
- else :
2513
- return _concat_date_cols_sequence(date_cols, rows_count, col_count,
2514
- keep_trivial_numbers)
2461
+ raise ValueError (" not all elements from date_cols are numpy arrays" )
0 commit comments