Advertisement
Guest User

Untitled

a guest
Mar 29th, 2015
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. def formula(df):
  2. formula = np.zeros([len(df.period.unique()),1])
  3. for i in range(len(period.unique())):
  4. count = 0
  5. amount = 0
  6. dt = df[df.datetime==fd.period.unique()[i]]
  7. for j in range(len(dt)):
  8. if count + dt.amount[j] <= 500:
  9. count = count + dt.amount[j]
  10. priceamount = amount + dt.amount[j]*dt.price[j]
  11. else:
  12. diff = 500-count
  13. priceamount = priceamount + diff*dt.price[j]
  14. formula[i] = priceamount/500
  15. break
  16. return formula
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement