Skip to content
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