Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Factor returning NaN

If I run

factor = Fundamentals.interest_bearing_borrowings_total.latest

pipe =  Pipeline(columns = {'factor'  : factor.rank().zscore()},  
                 screen = QTradableStocksUS())

run_pipeline(pipe, '2015-05-05', '2016-05-05')  

The resulting DataFrame contains only NaN. Curiously, if I use the following code, where the only change is the inclusion of groupyby = sector in the rank() method, I get the expected result. What's the reason for this behaviour? For other factors, it hasn't been necessary to groupby sector. For example Fundamentals.operating_income.latest / Fundamentals.interest_expense.latest doesn't require grouping.

sector = Fundamentals.morningstar_sector_code.latest

pipe =  Pipeline(columns = {'factor'  : factor.rank(groupby = sector).zscore()},  
                 screen = QTradableStocksUS())

run_pipeline(pipe, '2015-05-05', '2016-05-05')  

Thanks in advance.


Update

factor = Fundamentals.gross_profit.latest / Fundamentals.net_assets.latest returns factor values of NaN but factor = Fundamentals.gross_profit.latest / Fundamentals.total_assets.latest returns the expected results. What's causing this behaviour?