Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- 1.3: {1: 10, 2: 1, 3: None, 4: 10},
- 5.0: {1: None, 2: None, 3: None, 4: None},
- 7.0: {1: 10, 2: 1, 3: None, 4: 10},
- 7.1: {1: 100, 2: 10, 3: None, 4: 20},
- 10.3: {1: 100, 2: 10, 3: None, 4: 20},
- 10.4: {1: 103, 2: 20, 3: None, 4: 30},
- 5000: {1: 5.0, 2: 7.8, 3: 10.4, 4: 7.5}
- }
- #Create a list of final prices
- outcome = []
- for prices, hours in df.items():
- if prices == 5000:
- for i in hours:
- outcome.append(df.get(hours[i]))
- print("outcome:", outcome)
- Out: outcome: [5.0, 7.8, 10.4, 10.4, 10.4, 10.4, 10.4, 7.5]
- #Remove the nested Dict where key = 5000
- def removekey(d, key):
- r = dict(d)
- del r[key]
- return r
- d1 = removekey(d, 5000)
- #Loop through the list With price outcomes, and find out where this coincides with a bid step by sorting the keys
- for price in range(len(outcome)):
- for key in sorted(d1.keys()):
- if outcome[price] == key:
- print(key)
- Out:
- 5.0
- 10.4
Add Comment
Please, Sign In to add comment