@transformer<EOL>def group_singles2array(input, **params):
PARAM_FIELD_KEY = '<STR_LIT>'<EOL>PARAM_FIELD_ARRAY = '<STR_LIT>'<EOL>PARAM_FIELD_SINGLE = '<STR_LIT>'<EOL>field_key = params.get(PARAM_FIELD_KEY) if PARAM_FIELD_KEY in params else None<EOL>field_array = params.get(PARAM_FIELD_ARRAY)<EOL>field_single = params.get(PARAM_FIELD_SINGLE)<EOL>if not field_key:<EOL><INDENT>res = []<EOL>for item in input:<EOL><INDENT>res.append(item[field_single])<EOL><DEDENT>return {field_array: res}<EOL><DEDENT>else:<EOL><INDENT>tdict = {}<EOL>for row in input:<EOL><INDENT>if not row[field_key] in tdict:<EOL><INDENT>tdict.update({row[field_key]: [row[field_single]]})<EOL><DEDENT>else:<EOL><INDENT>tdict[row[field_key]].append(row[field_single])<EOL><DEDENT><DEDENT>res = []<EOL>for key, value in tdict.items():<EOL><INDENT>res.append({field_key: key, field_array: value})<EOL><DEDENT>return res<EOL><DEDENT>
Creates array of strings or ints from objects' fields
:param input: list of objects
:param params:
:return: list