[Numpy-discussion] annoying Deprecation warnings about non-integers

Nathaniel Smith njs at pobox.com
Wed Jul 1 00:15:28 EDT 2015


On Jun 30, 2015 9:01 PM, <josef.pktd at gmail.com> wrote:
>
> I'm trying to fix some code in statsmodels that creates Deprecation
Warnings from numpy
>
> Most of it are quite easy to fix, mainly cases where we use floats to
avoid integer division
>
> I have two problems
>
> first, I get Deprecation warnings in the test run that don't specify
where they happen.
> I try to find them with file searches, but I don't see a `np.ones` that
might cause a problem
> (needle in a haystack: Close to 4000 unittests and more than 100,000
lines of numpython)
> Also, I'm not sure the warnings are only from statsmodels, they could be
in numpy, scipy or pandas, couldn't they?
>
>
> second, what's wrong with non-integers in `np.r_[[np.nan] * head, x,
[np.nan] * tail]` (see below)
>
> I tried to set the warnings filter to `error` but then Python itself
errored right away.

I'd try using a more targeted error filter. Python trends to spit out a
bunch of ImportWarnings on startup. You can make a warnings filter that
does "error" but only for DeprecationWarning. Or only for
DeprecationWarning matching the regexp "non-integer".

-n
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20150630/7bc72d80/attachment.html>


More information about the NumPy-Discussion mailing list