Advertisement
g96

Untitled

g96
Mar 22nd, 2022
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.36 KB | None | 0 0
  1. import os
  2.  
  3. import pandas as pd
  4.  
  5. dict={
  6.     "Littlewoods Shop Direct Group": 'Emma',
  7.     "NEXT PLC" : "Emma",
  8.     "Asos.com UK" : "Nele",
  9.     "Zalando SE" : "Emelie, Nilmara",
  10.     "AMAZON EU SARL" : "Augustin",
  11.     "Wehkamp Bv" : 'Manuel',
  12.     "Otto-Versand GmbH & Co. KG": "Anna-lena",
  13.     "Boozt Fashion AB": "Manuel",
  14.     "Publikat GmbH" : "Manuel",
  15.     "ASOS EU": "Nele",
  16.     "ABOUT YOU SE & Co. KG": "Anna-lena"
  17. }
  18.  
  19. path = r'C://Users//Desktop//Autoreport//Load_attachments//'
  20. for filename in os.listdir(path):
  21.     if filename.startswith("PB orders"):
  22.         filename, extension = os.path.splitext(filename)
  23.         print(filename)
  24.         os.rename(path + filename + extension, path + filename[0:13] + extension)
  25.  
  26. for filename in os.listdir(path):
  27.     if filename.startswith("PB orders"):
  28.         full_path = os.path.join(path, filename)
  29.         month = pd.read_excel(full_path, sheet_name="Raw data ", engine="pyxlsb")
  30.         month = month[month['Sales Manager'] == 'MCLEAN, COLM']
  31.         month=month.drop(month.columns[[10]], axis=1)
  32.         month=month.drop(month.loc[month['Sold-To Name']=='JD Williams and Co Ltd'].index,inplace=True)
  33.         month["O2CX"] = month['Sold-To Name'].map(dict)
  34.         filename, extension = os.path.splitext(filename)
  35.         line = filename + '.csv'
  36.         month.to_csv (path + line, index = None, header=True)
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement