MCPcopy
hub / github.com/pandas-dev/pandas / cat_core

Function cat_core

pandas/core/strings/accessor.py:4777–4801  ·  view source on GitHub ↗

Auxiliary function for :meth:`str.cat` Parameters ---------- list_of_columns : list of numpy arrays List of arrays to be concatenated with sep; these arrays may not contain NaNs! sep : string The separator string for concatenating the columns. Retur

(list_of_columns: list, sep: str)

Source from the content-addressed store, hash-verified

4775
4776
4777def cat_core(list_of_columns: list, sep: str):
4778 """
4779 Auxiliary function for :meth:`str.cat`
4780
4781 Parameters
4782 ----------
4783 list_of_columns : list of numpy arrays
4784 List of arrays to be concatenated with sep;
4785 these arrays may not contain NaNs!
4786 sep : string
4787 The separator string for concatenating the columns.
4788
4789 Returns
4790 -------
4791 nd.array
4792 The concatenation of list_of_columns with sep.
4793 """
4794 if sep == "":
4795 # no need to interleave sep if it is empty
4796 arr_of_cols = np.asarray(list_of_columns, dtype=object)
4797 return np.sum(arr_of_cols, axis=0)
4798 list_with_sep = [sep] * (2 * len(list_of_columns) - 1)
4799 list_with_sep[::2] = list_of_columns
4800 arr_with_sep = np.asarray(list_with_sep, dtype=object)
4801 return np.sum(arr_with_sep, axis=0)
4802
4803
4804def _result_dtype(arr):

Callers 1

cat_safeFunction · 0.85

Calls 1

sumMethod · 0.45

Tested by

no test coverage detected