[Numpy-discussion] nan result from np.linalg.lstsq()

Larry Paltrow larry.paltrow@gmail....
Mon Oct 29 04:21:12 CDT 2012


Ok thanks, I figured np.isnan(data) is True is what we want but wasn't
certain. I think it should describe the same thing.

np.all(~np.isnan(data))
>>> False

Seems to be all non-nan

On Mon, Oct 29, 2012 at 2:12 AM, eat <e.antero.tammi@gmail.com> wrote:

> Hi,
>
> On Mon, Oct 29, 2012 at 11:01 AM, Larry Paltrow <larry.paltrow@gmail.com>wrote:
>
>> np.isnan(data) is True
>> >>> False
>>
> Check with:
> np.all(~np.isnan(x))
>
> My 2 cents,
> -eat
>
>>
>>
>> On Mon, Oct 29, 2012 at 1:50 AM, Pauli Virtanen <pav@iki.fi> wrote:
>>
>>> Larry Paltrow <larry.paltrow <at> gmail.com> writes:
>>> > I'm having some trouble using the linalg.lstsq() function
>>> > with certain data and trying to understand why. It's
>>> > always returning nans when I feed it this numpy array of float64 data:
>>> >
>>> > data = df.close.values #coming from a pandas dataframe
>>> >
>>> > type(data)
>>> > >>> numpy.ndarray
>>>
>>> Maybe you have NaNs in the array? (i.e. np.isnan(data) is True)
>>>
>>> --
>>> Pauli Virtanen
>>>
>>>
>>> _______________________________________________
>>> NumPy-Discussion mailing list
>>> NumPy-Discussion@scipy.org
>>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>>
>>
>>
>> _______________________________________________
>> NumPy-Discussion mailing list
>> NumPy-Discussion@scipy.org
>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>
>>
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20121029/0ace6ca4/attachment-0001.html 


More information about the NumPy-Discussion mailing list