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"]))
names (list) – List of string.
String if len(list) == 1
list or str