import pytest from statsmodels.datasets import elnino from statsmodels.graphics.functional import ( banddepth, fboxplot, hdrboxplot, rainbowplot, ) try: import matplotlib.pyplot as plt except ImportError: pass data = elnino.load() data.raw_data = np.asarray(data.raw_data) labels = data.raw_data[:, 0].astype(int) data = data.raw_data[:, 1:] @pytest.mark.matplotlib def test_hdr_basic(close_figures): try: _, hdr = hdrboxplot(data, labels=labels, seed=12345) except WindowsError: pytest.xfail('Multiprocess randomly crashes in Windows testing') assert len(hdr.extra_quantiles) == 0 median_t = [
import numpy as np from numpy.testing import assert_equal, assert_almost_equal import pytest from statsmodels.datasets import elnino from statsmodels.graphics.functional import \ hdrboxplot, banddepth, fboxplot, rainbowplot try: import matplotlib.pyplot as plt except ImportError: pass data = elnino.load(as_pandas=False) labels = data.raw_data[:, 0].astype(int) data = data.raw_data[:, 1:] @pytest.mark.matplotlib def test_hdr_basic(close_figures): try: _, hdr = hdrboxplot(data, labels=labels, seed=12345) except WindowsError: pytest.xfail('Multiprocess randomly crashes in Windows testing') assert len(hdr.extra_quantiles) == 0 median_t = [24.247, 25.625, 25.964, 24.999, 23.648, 22.302, 21.231, 20.366, 20.168, 20.434, 21.111, 22.299]
from statsmodels.compat.python import range import numpy as np from numpy.testing import assert_equal, assert_almost_equal import pytest from statsmodels.datasets import elnino from statsmodels.graphics.functional import \ hdrboxplot, banddepth, fboxplot, rainbowplot try: import matplotlib.pyplot as plt except ImportError: pass data = elnino.load(as_pandas=False) labels = data.raw_data[:, 0].astype(int) data = data.raw_data[:, 1:] @pytest.mark.matplotlib def test_hdr_basic(close_figures): try: _, hdr = hdrboxplot(data, labels=labels, seed=12345) except WindowsError: pytest.xfail('Multiprocess randomly crashes in Windows testing') assert len(hdr.extra_quantiles) == 0 median_t = [ 24.247, 25.625, 25.964, 24.999, 23.648, 22.302, 21.231, 20.366, 20.168,
from numpy.testing import assert_equal, assert_almost_equal from statsmodels.datasets import elnino from statsmodels.graphics.functional import \ hdrboxplot, banddepth, fboxplot, rainbowplot try: import matplotlib.pyplot as plt import matplotlib have_matplotlib = True except ImportError: have_matplotlib = False data = elnino.load() labels = data.raw_data[:, 0].astype(int) data = data.raw_data[:, 1:] @skipif(not have_matplotlib, reason='matplotlib not available') def test_hdr_basic(): fig, hdr = hdrboxplot(data, labels=labels) print(hdr) assert len(hdr.extra_quantiles) == 0 median_t = [24.247, 25.625, 25.964, 24.999, 23.648, 22.302, 21.231, 20.366, 20.168, 20.434, 21.111, 22.299] assert_almost_equal(hdr.median, median_t, decimal=2)