Guest User

Untitled

a guest
Jun 21st, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. {
  2. 1.3: {1: 10, 2: 1, 3: None, 4: 10},
  3. 5.0: {1: None, 2: None, 3: None, 4: None},
  4. 7.0: {1: 10, 2: 1, 3: None, 4: 10},
  5. 7.1: {1: 100, 2: 10, 3: None, 4: 20},
  6. 10.3: {1: 100, 2: 10, 3: None, 4: 20},
  7. 10.4: {1: 103, 2: 20, 3: None, 4: 30},
  8. 5000: {1: 5.0, 2: 7.8, 3: 10.4, 4: 7.5}
  9. }
  10.  
  11. #Create a list of final prices
  12. outcome = []
  13. for prices, hours in df.items():
  14. if prices == 5000:
  15. for i in hours:
  16. outcome.append(df.get(hours[i]))
  17. print("outcome:", outcome)
  18. Out: outcome: [5.0, 7.8, 10.4, 10.4, 10.4, 10.4, 10.4, 7.5]
  19.  
  20. #Remove the nested Dict where key = 5000
  21. def removekey(d, key):
  22. r = dict(d)
  23. del r[key]
  24. return r
  25. d1 = removekey(d, 5000)
  26.  
  27. #Loop through the list With price outcomes, and find out where this coincides with a bid step by sorting the keys
  28. for price in range(len(outcome)):
  29. for key in sorted(d1.keys()):
  30. if outcome[price] == key:
  31. print(key)
  32. Out:
  33. 5.0
  34. 10.4
Add Comment
Please, Sign In to add comment