Advertisement
famansour

Jaber

Nov 7th, 2020
2,397
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.02 KB | None | 0 0
  1. import pandas
  2. import numpy
  3.  
  4. inputPandas = pandas.read_excel (r'C:\Users\DELL 5470\Desktop\Classeur1.xlsx',sheet_name='Feuil2')
  5. inputList= inputPandas.values.tolist()
  6.  
  7. outputList = numpy.zeros((len(inputList), 4))
  8. outputList = outputList.tolist()
  9.  
  10. for iLoop in range(0, len(inputList)):
  11.     for jLoop in range(0, len(inputList[0])):
  12.  
  13.         inputList [iLoop][jLoop]= str(inputList[iLoop][jLoop])
  14.        
  15. for iLoop in range(0, len(inputList)):
  16.     for jLoop in range(0, len(inputList[0])-2):
  17.  
  18.         outputList [iLoop][jLoop]= str(outputList[iLoop][jLoop])
  19.  
  20.  
  21.  
  22. for iLoop in range(0, len(inputList)):
  23.     if inputList[iLoop][0]=='':
  24.         outputList[iLoop][0]==''
  25.         outputList[iLoop][1]==''
  26.     else :
  27.         outputList[iLoop][0]=inputList[iLoop][0][0:9]
  28.         outputList[iLoop][1]=inputList[iLoop][0][10:]
  29.         outputList[iLoop][2]=inputList[iLoop][3]
  30.         outputList[iLoop][3]=inputList[iLoop][4]
  31.    
  32.    
  33. outputPandas = pandas.DataFrame(outputList)
  34.  
  35.  
  36. outputPandas.to_excel("output.xlsx")  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement