Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Coverting pandas columns to numpy arrays

I've got a pandas dataframe of stocks in the basic materials sector and I'd like to slice the columns that relate to specific stocks and put the values in a numpy array. Does anybody have any tips on how to implement this?

1 response
# List of symbols you want to select  
symbol_list = ['GOLD', ]

# Slices the symbol column of prices  
slce = (prices['symbol'] == symbol_list)

prices['price'][slce].values