I wanted to convert following multiple lines of code to a single line. I have tried but i am unable to achieve final result.
Multiple line of code :-
for k, v in FLOW_GROUPS.items():
if k == '':
[pd.Series(df_by_fulfillment_flow[v].sum(axis=1), name=k)]
else:
[pd.Series(df_by_fulfillment_flow[v].mean(axis=1), name=k)]
my success so far is given below, i want to add if condition also to it :-
[pd.Series(df_by_fulfillment_flow[v].sum(axis=1), name=k) for k, v in FLOW_GROUPS.items()]