Category : dictionary

I am working on this problem on kattis : https://open.kattis.com/contests/oxfcar/problems/babelfish I tested it with the input provided and it works fine but I submit on Kattis, I keep getting "RUN TIME ERROR!" What is the mistake here? I don’t understand at all. // build the dictionary by mapping foreign words to english line="a" dict1={} while ..

Read more

I recieve a payload like this (with more items of course): [{‘symbol’: ‘ETHBTC’, ‘bidPrice’: ‘0.07729000’, ‘bidQty’: ‘5.03500000’, ‘askPrice’: ‘0.07729800’, ‘askQty’: ‘0.09520000’}, {‘symbol’: ‘LTCBTC’, ‘bidPrice’: ‘0.00337600’, ‘bidQty’: ‘91.41500000’, ‘askPrice’: ‘0.00337700’, ‘askQty’: ‘30.81900000’}] and I need just extract the value for the key: bidPrice for a specific symbol I try this: (?<=ETHBTC.)(.+?), and obtain this: , ‘bidPrice’: ..

Read more

I’m, trying to to add a new column to my df that will be mapped by ranges of other column in the same df. I’m using pandas.series.between() function to define the new values but getting an error: TypeError: unhashable type: ‘Series’ This is what I have tried: my_dict = {df[‘column’].between(0.0, 5.0) : 1, df[‘column’].between(5.1, 7.0) ..

Read more