https://github.com/calcuis/simple-calculation-output-example
https://github.com/calcuis/simple-calculation-output-example
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/calcuis/simple-calculation-output-example
- Owner: calcuis
- Created: 2024-11-02T01:18:48.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-11-02T03:42:32.000Z (7 months ago)
- Last Synced: 2025-01-21T13:11:31.147Z (5 months ago)
- Language: Python
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### simple calculation and output example
try it out by:
```
py calculator.py
```
### code explanation
- Reading the csv: The `input.csv` file is loaded into a `DataFrame`.
- Grouping and Summing: The `DataFrame` is grouped by `id` and `group`, summing the `min` column.
- Exporting to csv: The grouped data is saved in `output.csv`.
- Exporting to json: The grouped data is restructured into a json format, nested under each id, and saved to `output.json`.it will produce two files (`output.csv` and `output.json`) as a result; enjoy!