row_dict = row.to_dict()
for item in row_dict:
    Dict[item] = [row[item]] * row[args[0]]
return pd.DataFrame(Dict)

def ExpandRows(df, WeightsColumnName):
    df_expand = df.groupby(df.columns.tolist(), group_keys=False).apply(f,
        WeightsColumnName).reset_index(drop=True)
return df_expand
df_expanded = ExpandRows(df, 'count')
print(df_expanded)
pandas: apply function to DataFrame that can return multiple rows