team - Umbrella
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
566 B

5 years ago
  1. import csv
  2. import json
  3. import pandas as pd
  4. # csv_data = pd.read_csv("C:\Users\qjems\Desktop\crowd\dummy_data\dummy_crowd_data.csv", sep = ",")
  5. # csv_data.to_json("C:\Users\qjems\Desktop\crowd\dummy_data\dummy_crowd_data.json", orient = "records")
  6. with open('C:\Users\qjems\Desktop\crowd\dummy_data\dummy_crowd_data.csv') as file_csv:
  7. fieldnames = ("time","A_sector","B_sector","C_sector")
  8. reader = csv.DictReader(file_csv, fieldnames)
  9. with open('dummy_crowd_data.json', 'w') as file_json:
  10. for row in reader:
  11. json.dump(row, file_json)