Advertisement
g96

Untitled

g96
Feb 22nd, 2022
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 KB | None | 0 0
  1. # create df
  2. df = pd.Series(data).str.split('|', expand=True).rename(columns=dict(enumerate(cols))).iloc[:-2, 1:]
  3.  
  4. # remove leading/trailing whitespace
  5. df = df.apply(lambda s: s.str.strip(), axis=1)
  6. df.columns = df.columns.str.strip()
  7.  
  8. columns =['Order Qty (SL)','Confirmed Qty (SL)','Unconfirmed Qty (SL)','Cancelled Qty (SL)','Open Qty (SL)','Reserved Qty (SL)',
  9.  
  10.     'Fixed Qty (SL)','% Allocation (SL)','Delivered Qty (SL)','PGI Qty (SL)','Invoiced Qty (SL)',
  11.     'Net Unit Price','Confirmed Net Value (SL)','Dollars Shipped (SL)','% Shipped/Allocated (SL)']
  12.  
  13. df[columns]= df[columns].apply(pd.to_numeric)/1000
  14.  
  15. print(df)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement