Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
Open EdX Data Visualization
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CS 5934 Team 2 (Blacksburg)
Open EdX Data Visualization
Commits
bb05f79e
Commit
bb05f79e
authored
1 year ago
by
Emily Nicole Adams
Browse files
Options
Downloads
Patches
Plain Diff
renormalizing files
parent
40834f61
1 merge request
!6
Git attributes
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/csvToJson.py
+16
-16
16 additions, 16 deletions
scripts/csvToJson.py
with
16 additions
and
16 deletions
scripts/csvToJson.py
+
16
−
16
View file @
bb05f79e
import
csv
import
json
csv_path
=
r
'
C:\Users\12408\Downloads\test.csv
'
#Change according to the location of csv file
json_path
=
r
'
./src/utils/csvtopy.json
'
with
open
(
csv_path
,
'
r
'
,
encoding
=
'
ISO-8859-1
'
)
as
csvfile
,
open
(
json_path
,
'
w
'
)
as
jsonfile
:
reader
=
csv
.
reader
(
csvfile
)
headers
=
next
(
reader
)
rows
=
[]
for
row
in
reader
:
row_dict
=
{}
for
i
in
range
(
len
(
headers
)):
row_dict
[
headers
[
i
]]
=
row
[
i
]
rows
.
append
(
row_dict
)
import
csv
import
json
csv_path
=
r
'
C:\Users\12408\Downloads\test.csv
'
#Change according to the location of csv file
json_path
=
r
'
./src/utils/csvtopy.json
'
with
open
(
csv_path
,
'
r
'
,
encoding
=
'
ISO-8859-1
'
)
as
csvfile
,
open
(
json_path
,
'
w
'
)
as
jsonfile
:
reader
=
csv
.
reader
(
csvfile
)
headers
=
next
(
reader
)
rows
=
[]
for
row
in
reader
:
row_dict
=
{}
for
i
in
range
(
len
(
headers
)):
row_dict
[
headers
[
i
]]
=
row
[
i
]
rows
.
append
(
row_dict
)
json
.
dump
(
rows
,
jsonfile
,
indent
=
4
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment