Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
np.linalg.lstsq , Error: DLASCL parameter number 4 had an illegal value

Anyone know why I get this error with the following code:

history = data.history(context.output.index, "price", 250, "1d")

    for stock in pairs:  
        if stock[0].symbol <> stock[1].symbol:  
            constant =  np.ones((history[stock[0]].shape[0],1)).T.ravel()  
            independent = np.array(history[stock[0]])  
            y = np.array(history[stock[1]])

            A = np.vstack((independent,constant)).T  
            m, c = np.linalg.lstsq(A, y)[0]       # This is line 156 by the way...  
ValueError: On entry to DLASCL parameter number 4 had an illegal value  
There was a runtime error on line 156.  

And this bug happens ONLY for some securities and on specific time periods.

Or, anyone know how I could debug this ?