slitflow.fun.misc module

reduce_list(names)[source]

Return string if len(list) == 1 to avoid pandas warning.

df.groupby([“a”]) returns warning. To avoid this, input should be df.groupby(“a”). This function can be used as follows:

from fun.misc import reduce_list as rl
df.groupby(rl(["a"]))
Parameters:

names (list) – List of string.

Returns:

String if len(list) == 1

Return type:

list or str