Advertisement
g96

Untitled

g96
Feb 18th, 2022
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.09 KB | None | 0 0
  1. df_1 = pd.read_excel(os.path.join(directory,'copy.xlsm'), sheet_name= "weekly",header= None)
  2. df_1 = df_1.drop(df_1.columns[[0,1]], axis=1)
  3. df_1.columns = df_1.loc[3].rename(None)
  4. df_1 = df_1.drop(range(5))
  5.  
  6. df_1.to_csv(directory + '1.csv', index=False, header= True)
  7.  
  8. df=pd.read_csv(os.path.join(directory,'1.csv'))
  9.  
  10.  
  11.  
  12. cols =['Order Qty (SL)','Confirmed Qty (SL)','Unconfirmed Qty (SL)','Cancelled Qty (SL)','Open Qty (SL)','Reserved Qty (SL)',
  13.  
  14.     'Fixed Qty (SL)','% Allocation (SL)','Delivered Qty (SL)','PGI Qty (SL)','Invoiced Qty (SL)',
  15.     'Net Unit Price','Confirmed Net Value (SL)','Dollars Shipped (SL)','% Shipped/Allocated (SL)']
  16.  
  17. df.loc[:len(df) - 2, cols].replace(',', '', regex=True).apply(pd.to_numeric).dtypes.unique()
  18.  
  19.  
  20. df[['Order Qty (SL)','Confirmed Qty (SL)','Unconfirmed Qty (SL)','Cancelled Qty (SL)','Open Qty (SL)','Reserved Qty (SL)',
  21.  
  22.     'Fixed Qty (SL)','% Allocation (SL)','Delivered Qty (SL)','PGI Qty (SL)','Invoiced Qty (SL)',
  23.     'Net Unit Price','Confirmed Net Value (SL)','Dollars Shipped (SL)','% Shipped/Allocated (SL)']] /= 1000
  24.  
  25. print(df.head())
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement