Skip to content

Commit

Permalink
python tools
Browse files Browse the repository at this point in the history
  • Loading branch information
linrakesh committed Jan 22, 2020
2 parents 0efcf03 + 4862d6b commit cb1baef
Show file tree
Hide file tree
Showing 23 changed files with 305 additions and 634 deletions.
2 changes: 1 addition & 1 deletion fileHandling/Bulk_Image_Resizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def small(source,target,original):
dest = target + '\\' +original
with open(original, 'r+b') as f:
with Image.open(f) as image:
cover = resizeimage.resize_cover(image, [960, 640], validate=False)
cover = resizeimage.resize_cover(image, [383, 119], validate=False)
cover.save(dest, image.format)

def deleteFiles():
Expand Down
11 changes: 11 additions & 0 deletions fileHandling/convert.csv
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, -
26 changes: 26 additions & 0 deletions fileHandling/csv_to_json_converter.py
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,))



19 changes: 19 additions & 0 deletions fileHandling/json_to_csv.py
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)
1 change: 1 addition & 0 deletions jsonFile.json
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": " -"}]
6 changes: 0 additions & 6 deletions pandas/.ipynb_checkpoints/Untitled-checkpoint.ipynb

This file was deleted.

6 changes: 0 additions & 6 deletions pandas/.ipynb_checkpoints/Untitled1-checkpoint.ipynb

This file was deleted.

6 changes: 0 additions & 6 deletions pandas/.ipynb_checkpoints/Untitled2-checkpoint.ipynb

This file was deleted.

32 changes: 0 additions & 32 deletions pandas/.ipynb_checkpoints/hello-checkpoint.ipynb

This file was deleted.

6 changes: 0 additions & 6 deletions pandas/Untitled.ipynb

This file was deleted.

62 changes: 0 additions & 62 deletions pandas/Untitled1.ipynb

This file was deleted.

Loading

0 comments on commit cb1baef

Please sign in to comment.