Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grouped/nonGrouped CSV output by default #2274

Open
szabozoltan69 opened this issue Sep 25, 2024 · 1 comment
Open

Grouped/nonGrouped CSV output by default #2274

szabozoltan69 opened this issue Sep 25, 2024 · 1 comment
Assignees

Comments

@szabozoltan69
Copy link
Contributor

Instead of
https://github.com/IFRCGo/go-api/blob/develop/per/custom_renderers.py#L9
we should make possible to use a new argument for CSV download, grouped / non-grouped, to have narrow CSV output.

A solution might be via:

import pandas as pd
data = [
    {'a': 'value1', 'b': 'value2', 'c': ['c1', 'c2', 'c3'], 'f': 'value4'},
    {'a': 'value5', 'b': 'value6', 'c': ['c4', 'c5'], 'f': 'value7'}
]
df = pd.DataFrame(data)
df_exploded = df.explode('c')
df_exploded = df_exploded[['a', 'b', 'c', 'f']]
df_exploded.to_csv('output.csv', index=False)

Or, the DEEP solution might be considered.

@szabozoltan69
Copy link
Contributor Author

@samshara @batpad

@tnagorra tnagorra removed the feature label Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants