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

delete extra line between each row in csv export & command line to run in jupyter notebook #38

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ Usage
python /path/to/json_to_csv.py node json_in_file_path csv_out_file_path
```


If you want to run the script via a jupyter notebook, you can use code below:

```
!python "json_to_csv.py" "STATION" "metadata.json" "metadata__2.csv"
```

Source Specification
--------------------
The script expects the json to be given via a file containing
Expand Down
2 changes: 1 addition & 1 deletion json_to_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def reduce_item(key, value):
header = list(set(header))
header.sort()

with open(csv_file_path, 'w+') as f:
with open(csv_file_path, 'w+', newline='') as f:
writer = csv.DictWriter(f, header, quoting=csv.QUOTE_ALL)
writer.writeheader()
for row in processed_data:
Expand Down