Back to Community
Excluding pipeline items from a top() list

I am trying to find the top(10) stocks with the most bear_scored_messages in the stocktwits data. My problem is that they also sometimes exist in the top(10) stock with the most bull_scored_messages (highly controversial message boards). I am not entirely sure what datatype is being used after using the top() method on a factor, and therefore cannot figure out how to perform removals on the list in reference to another.

def make_pipeline(stocks, trend_days):  
    # Set our universe  
    base_universe = QTradableStocksUS()  
    bullSentiment = stocktwits_free.bull_scored_messages.latest  
    bearSentiment = stocktwits_free.bear_scored_messages.latest  
    topBears = bearSentiment.top(50)  
    topBulls = bullSentiment.top(50)  
#     Remove the intersection of the two ?arrays?

#     onlyBears = topBears != topBulls  
#     onlyBears = [stock for stock in topBears if not in topBulls]  
    pipe = Pipeline(  
        columns={  
            'bearSentiment': bearSentiment,  
        },  
        screen=onlyBears  
    )  
    return pipe  

I'm not familiar with these custom methods but the solution has to be pretty simple, if anyone could steer me in the right direction it would be greatly appreciated!