Skip to content
Advertisement

Select dataframe index derived from comparing a dataframe column and a list

Considering the instrument_ticker dataframe and tickers list below:

JavaScript

I do a split to select the first item of each value obtained from this operation of each line:

JavaScript

Now, how can I get the index of instrument_ticker where Reduced_Ticker contains a ticker_reduced item? I need to save this in a list, like the following (expected output):

JavaScript

Advertisement

Answer

Select what you require by checking the first split term of Reduced_Ticker, followed by obtaining the index of the selected rows:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement