Skip to content

Tag: pandas

how to do nested loop using apply in pandas

I have a data frame like this: I want o apply a function on pos and save the result in a new column. So the output would look like this: So the function return a list for each tuple in the list (but the implementation of the function is not the point here, for that I just call get_sentiment). I

Sort a dict of DataFrames

I have a dict of data-frames like the following: symbols ={BTC: DF, ETH: DF, DOGE:df} where each DF looks like this. I am trying to sort the dict by the price_change in the last row. Answer You could figure out the sorting of the keys by using a lambda function on sorted, which gets the last price change per …