Reputation: 885
I have a Dataframe, which has a bunch of ID name pairs in it. I create it by doing the following:
market_df = pd.DataFrame(markets_info['markets'])
market_df.astype(dict(id=int, name=str))
I received ID numbers from a process and I need to grab the associated name to that ID. I have tried creating an index on the ID and then parsing it, but that doesn't seem to set the ID correctly.
I now am trying to do the following: exch_name = MARKET_IDS.loc[MARKET_IDS['id'] == exchange_id, 'name']
I have verified that exchange_id
is also of type int
.
What am I missing here?
Upvotes: 0
Views: 33
Reputation: 135
I don't know if this is because you left out some crucial information from this, but from what it sounds like in your post you're not really altering market_df
at all, as your second line is not an assignment. It should read market_df = market_df.astype(dict(id=int, name=str))
Upvotes: 1