-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
305 additions
and
634 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
album, year, US_peak_chart_post | ||
The White Stripes,1999, - | ||
De Stijl,2000, - | ||
White Blood Cells,20.01,61 | ||
Elephant,2003,6 | ||
Get Behind Me Satan,2005,3 | ||
Icky Thump,2007,2 | ||
Under Great White Northern Lights,2010,11 | ||
Live in Mississippi,2011, - | ||
Live at the Gold Dollar,2012, - | ||
Nine Miles from the White City,2013, - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import csv | ||
import json | ||
with open(r'C:/Users/rakesh\Desktop/python/fileHandling/convert.csv') as csf_file: | ||
csv_reader = csv.reader(csf_file) | ||
line=0 | ||
keys=[] | ||
jon=[] | ||
for row in csv_reader: | ||
d = {} | ||
if line==0: | ||
for col in row: | ||
keys.append(col) | ||
else: | ||
for i in range(len(row)): | ||
d[keys[i]]=row[i] | ||
|
||
if(line>=1): | ||
jon.append(d) | ||
line+=1 | ||
#print(jon) | ||
|
||
with open("jsonFile.json","w") as json_file: | ||
json_file.write( json.dumps(jon,)) | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# program to convert json file in to csv file | ||
# program by : rakesh kumar | ||
# last edited : 14/01/2020 | ||
|
||
import json | ||
with open(r"C:/Users/rakesh\Desktop/python/jsonFile.json") as json_file: | ||
data = json.load(json_file) | ||
single=0 | ||
header=[] | ||
data=[] | ||
for x in data: | ||
if single==0: | ||
for y in x: | ||
header.append(y) | ||
break; | ||
else: | ||
for z in data: | ||
data.append(z[]) | ||
print(header) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[{"album": "The White Stripes", " year": "1999", " US_peak_chart_post": " -"}, {"album": "De Stijl", " year": "2000", " US_peak_chart_post": " -"}, {"album": "White Blood Cells", " year": "20.01", " US_peak_chart_post": "61"}, {"album": "Elephant", " year": "2003", " US_peak_chart_post": "6"}, {"album": "Get Behind Me Satan", " year": "2005", " US_peak_chart_post": "3"}, {"album": "Icky Thump", " year": "2007", " US_peak_chart_post": "2"}, {"album": "Under Great White Northern Lights", " year": "2010", " US_peak_chart_post": "11"}, {"album": "Live in Mississippi", " year": "2011", " US_peak_chart_post": " -"}, {"album": "Live at the Gold Dollar", " year": "2012", " US_peak_chart_post": " -"}, {"album": "Nine Miles from the White City", " year": "2013", " US_peak_chart_post": " -"}] |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.