Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Extracting symbols from Series

Hi,

Newbie question. I've been googling this one for a while now.
I'm trying to put on a list, the symbols of equities from Series.

My Series:

Equity(13984 [TGTX]) 0.089146
Equity(13867 [IMH]) 0.091517
Equity(24094 [MGPI]) 0.093951
Equity(44955 [PTCT]) 0.094191

Desired output:

['TGTX,'IMH', 'MGPI', 'PTCT']

I really appreciate any help you can provide.
Cordially,

Victor

4 responses

Try this:
stock_list = ... whatever you are using to generate a list of stocks

symbol_list = stock_list.index

Thank you Peter.

I'm well aware of the stock_list.index command.
The output would look something like this:

Index([Equity(13984 [TGTX]), Equity(13867 [IMH]), Equity(24094 [MGPI]),
dtype='object')

However, if I'm going to use this to define my universe of stocks (e.g. universe=symbols('AAPL',etc.), shouldn't the output, be of this type?
['TGTX,'IMH', 'MGPI', 'PTCT']

OK.
Maybe this will be more useful.

Try this