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
77 changes: 77 additions & 0 deletions project1/ExcelToSas.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Process Excel File and write New Processed Data In New File format
# each field seperated with <!|!>
#Remove all character with ascii value >128

from xlrd import open_workbook
import codecs
import sys


def trim(s):
# Remove Extra Spaces
ls=s.split(' ')
for i in range(ls.count('')):
ls.remove('')
return ' '.join(ls)
def remove_anomaly(s):
#Remove or replace data with ascii value greter than 128
cell_data=''
for ch in s:
if ord(ch)==160:
cell_data +=' '
elif ord(ch)>256:
cell_data +='-'
else:
cell_data +=chr(ord(ch))
while(len(cell_data)>0 and (cell_data[0]==' ' or cell_data[-1]==' ')):
if cell_data[0]==' ':
cell_data=cell_data[1:]
elif cell_data[-1]==' ' and len(cell_data)>0:
cell_data=cell_data[:-1]
return cell_data


f_name=raw_input('Enter Excel file name with extention :')
try:
wb = open_workbook(f_name) #Open File to read
try:
res=open('final.sas','w') #Where Result Going to save
except:
print 'Error in opning result file'
except:
print 'Error in opening file'

for s in wb.sheets(): # If More Than One Seet in Excel File , Even Then It process all data in all sheets
print 'Sheet:',s.name
for row in range(1,s.nrows): #for data in each row except the first row, as it is title of each row
values = []
Error=False
for col in range(s.ncols): #for data in in row=rowX and coloumn=col
if col!=0: # then remove extra space or ?
try:
cell_data=str(s.cell(row,col).value)
cell_data=trim(cell_data)
values.append(cell_data)
except:
try:
values.append(remove_anomaly(s.cell(row,col).value))
except:
print 'Error In Row ',row,'Do it manualy[block A]',s.cell(row,col).value
x=s.cell(row,col).value
Error=True
else:
try:
values.append(str(int(s.cell(row,col).value)))
except:
print 'Error In Row ',row,'Do it manualy[block b]'
Error=True

# col +=1
if(Error == False):
if values[-1].find('http://') == -1:
values[-1]='http://'+values[-1]

res.write('<!|!>'.join(values)+'\n')
res.close()
print 'Good Bye we r done , Check ""final.sua""'
raw_input()
3,489 changes: 0 additions & 3,489 deletions project1/admin/final.sas

Large diffs are not rendered by default.

43 changes: 0 additions & 43 deletions project1/project1 space or quetion mark problem.py

This file was deleted.

43 changes: 0 additions & 43 deletions project1/project1 sql model.sql

This file was deleted.

107 changes: 107 additions & 0 deletions project2/project2/ExcelToSaspr2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# Process Excel File and write New Processed Data In New File format
# each field seperated with <!|!>
#Remove all character with ascii value >128

from xlrd import open_workbook
import codecs
import sys

#________________________________________________________

def trim(s):
# Remove Extra Spaces
ls=s.split(' ')
for i in range(ls.count('')):
ls.remove('')
return ' '.join(ls)
def remove_anomaly(s):
#Remove or replace data with ascii value greter than 128
cell_data=''
for ch in s:
if ord(ch)==160:
cell_data +=' '
elif ord(ch)>256:
cell_data +='-'
else:
cell_data +=chr(ord(ch))
while(len(cell_data)>0 and (cell_data[0]==' ' or cell_data[-1]==' ')):
if cell_data[0]==' ':
cell_data=cell_data[1:]
elif cell_data[-1]==' ' and len(cell_data)>0:
cell_data=cell_data[:-1]
return cell_data


f_name=raw_input('Enter Excel file name with extention :')
try:
wb = open_workbook(f_name) #Open File to read
try:
res=open('final.sas','w') #Where Result Going to save
except:
print 'Error in opning result file'
except:
print 'Error in opening file'

for s in wb.sheets(): # If More Than One Seet in Excel File , Even Then It process all data in all sheets
print 'Sheet:',s.name
for row in range(1,s.nrows): #for data in each row except the first row, as it is title of each row
values = []
Error=False
for col in range(s.ncols): #for data in in row=rowX and coloumn=col
if col!=0: # then remove extra space or ?
try:
cell_data=str(s.cell(row,col).value)
cell_data=trim(cell_data)
values.append(cell_data)
except:
try:
values.append(remove_anomaly(s.cell(row,col).value))
except:
print 'Error In Row ',row,'Do it manually[block A]',s.cell(row,col).value
x=s.cell(row,col).value
Error=True
else:
try:
values.append(str(int(s.cell(row,col).value)))
except:
print 'Error In Row ',row,'Do it manualy[block b]'
Error=True

#finding department name:
if values[13]=='':
values[13]='NITR'
else:
xD = values[13].split(', ')
try:
xD.remove('NIT')
except:
pass
try:
xD.remove('Rourkela')
except:
pass
try:
xD.remove('NIT,Rourkela')
except:
pass
if len(xD)==0:
xD.append('NITR')
values[13]='|'.join(xD)

#------------------------------------------
if(Error == False):

#_----------Authers Of NITR---------------------
auth=values[1].split(', ')
authaff=values[15].split(';')
authors=[]
for i in range(len(auth)):
if authaff[i].find('Rourkela') !=-1:
authors.append(auth[i])
values.append('{|}'.join(authors))
#______________________________________________
values.append('')
res.write('<!|!>'.join(values)+'\n')
res.close()
print 'Good Bye we r done , Check ""final.sas""'
raw_input()
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[.ShellClassInfo]
InfoTip=This folder is shared online.
IconFile=C:\Program Files (x86)\Google\Drive\googledrivesync.exe
IconFile=C:\Program Files\Google\Drive\googledrivesync.exe
IconIndex=12

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added project2/project2/admin/css/images/bodybg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions project2/project2/admin/css/images/desktop.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[.ShellClassInfo]
InfoTip=This folder is shared online.
IconFile=C:\Program Files\Google\Drive\googledrivesync.exe
IconIndex=12

Binary file added project2/project2/admin/css/images/nav-bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added project2/project2/admin/css/images/nav-left.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added project2/project2/admin/css/images/nav-right.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added project2/project2/admin/css/images/quote.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added project2/project2/admin/css/images/readmore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading