From 418e3bf0789dcd7d064de55a266b186d4ab42774 Mon Sep 17 00:00:00 2001 From: Ralf Gommers Date: Sun, 14 Apr 2019 23:02:20 +0200 Subject: DOC: fix 4 remaining doc build warnings. 2 for polyfit rankwarning, 2 for divide by zero in log10. --- numpy/lib/polynomial.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'numpy/lib/polynomial.py') diff --git a/numpy/lib/polynomial.py b/numpy/lib/polynomial.py index 62f96f773..8c6f69cb0 100644 --- a/numpy/lib/polynomial.py +++ b/numpy/lib/polynomial.py @@ -548,6 +548,7 @@ def polyfit(x, y, deg, rcond=None, full=False, w=None, cov=False): Examples -------- + >>> import warnings >>> x = np.array([0.0, 1.0, 2.0, 3.0, 4.0, 5.0]) >>> y = np.array([0.0, 0.8, 0.9, 0.1, -0.8, -1.0]) >>> z = np.polyfit(x, y, 3) @@ -566,9 +567,10 @@ def polyfit(x, y, deg, rcond=None, full=False, w=None, cov=False): High-order polynomials may oscillate wildly: - >>> p30 = np.poly1d(np.polyfit(x, y, 30)) + >>> with warnings.catch_warnings(): + ... warnings.simplefilter('ignore', np.RankWarning) + ... p30 = np.poly1d(np.polyfit(x, y, 30)) ... - >>> # RankWarning: Polyfit may be poorly conditioned... >>> p30(4) -0.80000000000000204 # may vary >>> p30(5) -- cgit v1.2.1