Skip to content

Commit e6cd4b8

Browse files
authored
Merge pull request #80 from ACCLAB/v0.2.7
v0.2.7
2 parents efc0732 + 1c56992 commit e6cd4b8

File tree

13 files changed

+146
-87
lines changed

13 files changed

+146
-87
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ env:
55
- PYTHON=3.5 BACKEND=agg
66
- PYTHON=3.6 BACKEND=agg
77
- PYTHON=3.7 BACKEND=agg
8+
# - PYTHON=3.8 BACKEND=agg
89

910

1011
before_install:
@@ -21,6 +22,7 @@ install:
2122
- conda update conda --yes
2223
- conda config --add channels conda-forge
2324
- conda create -n testenv --yes pip python=$PYTHON matplotlib
25+
# - if [ "$PYTHON" = "3.8" ]; then conda create -n testenv --yes --channel conda-forge/label/pre-3.8 pip python=$PYTHON; else conda create -n testenv --yes pip python=$PYTHON matplotlib; fi
2426
- source activate testenv
2527
- pip install .[dev]
2628

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22
[![Travis CI build status](https://travis-ci.org/ACCLAB/DABEST-python.svg?branch=master)](https://travis-ci.org/ACCLAB/DABEST-python)
33
[![minimal Python version](https://img.shields.io/badge/Python%3E%3D-3.5-6666ff.svg)](https://www.anaconda.com/distribution/)
44
[![PyPI version](https://badge.fury.io/py/dabest.svg)](https://badge.fury.io/py/dabest)
5-
[![PyPI Downloads](https://img.shields.io/pypi/dm/dabest?color=bright-green)](https://pypistats.org/packages/dabest)
5+
[![Downloads](https://pepy.tech/badge/dabest/month)](https://pepy.tech/project/dabest/month)
66
[![Free-to-view citation](https://zenodo.org/badge/DOI/10.1038/s41592-019-0470-3.svg)](https://rdcu.be/bHhJ4)
77
[![License](https://img.shields.io/badge/License-BSD%203--Clause--Clear-orange.svg)](https://spdx.org/licenses/BSD-3-Clause-Clear.html)
88

9-
109
## About
1110

1211
DABEST is a package for **D**ata **A**nalysis using **B**ootstrap-Coupled **EST**imation.

dabest/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@
2323
from ._stats_tools import effsize as effsize
2424
from ._classes import TwoGroupsEffectSize
2525

26-
__version__ = "0.2.6"
26+
__version__ = "0.2.7"

dabest/_classes.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,11 @@ def __init__(self, data, idx, x, y, paired, id_col, ci, resamples,
143143
value_vars=all_plot_groups,
144144
value_name=self.__yvar,
145145
var_name=self.__xvar)
146+
147+
# Added in v0.2.7.
148+
# remove any NA rows.
149+
plot_data.dropna(axis=0, how='any', subset=[self.__yvar], inplace=True)
150+
146151

147152
# Lines 131 to 140 added in v0.2.3.
148153
# Fixes a bug that jammed up when the xvar column was already
41.4 KB
Loading
41.4 KB
Loading
File renamed without changes.

dabest/tests/test_03_plotting.py

Lines changed: 100 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
import pytest
77
import numpy as np
88
import pandas as pd
9+
from scipy.stats import norm
10+
11+
912
import matplotlib as mpl
1013
mpl.use('Agg')
1114
import matplotlib.pyplot as plt
@@ -42,13 +45,13 @@
4245
("Control 3", "Test 4","Test 5", "Test 6")
4346
))
4447

45-
46-
48+
49+
4750
@pytest.mark.mpl_image_compare
4851
def test_01_gardner_altman_unpaired_meandiff():
4952
return two_groups_unpaired.mean_diff.plot();
50-
51-
53+
54+
5255

5356
@pytest.mark.mpl_image_compare
5457
def test_02_gardner_altman_unpaired_mediandiff():
@@ -59,15 +62,15 @@ def test_02_gardner_altman_unpaired_mediandiff():
5962
@pytest.mark.mpl_image_compare
6063
def test_03_gardner_altman_unpaired_hedges_g():
6164
return two_groups_unpaired.hedges_g.plot();
62-
63-
64-
65+
66+
67+
6568
@pytest.mark.mpl_image_compare
6669
def test_04_gardner_altman_paired_meandiff():
6770
return two_groups_paired.mean_diff.plot();
68-
69-
70-
71+
72+
73+
7174
@pytest.mark.mpl_image_compare
7275
def test_04_gardner_altman_paired_hedges_g():
7376
return two_groups_paired.hedges_g.plot();
@@ -78,41 +81,40 @@ def test_04_gardner_altman_paired_hedges_g():
7881
def test_05_cummings_two_group_unpaired_meandiff():
7982
return two_groups_unpaired.mean_diff.plot(fig_size=(4, 6),
8083
float_contrast=False);
81-
82-
83-
84+
85+
86+
8487
@pytest.mark.mpl_image_compare
8588
def test_06_cummings_two_group_paired_meandiff():
8689
return two_groups_paired.mean_diff.plot(fig_size=(6, 6),
8790
float_contrast=False);
88-
89-
90-
91+
92+
93+
9194
@pytest.mark.mpl_image_compare
9295
def test_07_cummings_multi_group_unpaired():
9396
return multi_2group.mean_diff.plot();
94-
95-
96-
97-
97+
98+
99+
98100
@pytest.mark.mpl_image_compare
99101
def test_08_cummings_multi_group_paired():
100102
return multi_2group_paired.mean_diff.plot(fig_size=(6, 6));
101-
102-
103-
103+
104+
105+
104106
@pytest.mark.mpl_image_compare
105107
def test_09_cummings_shared_control():
106108
return shared_control.mean_diff.plot();
107-
108-
109+
110+
109111

110112
@pytest.mark.mpl_image_compare
111113
def test_10_cummings_multi_groups():
112114
return multi_groups.mean_diff.plot();
113-
114-
115-
115+
116+
117+
116118
@pytest.mark.mpl_image_compare(tolerance=20)
117119
def test_11_inset_plots():
118120

@@ -164,27 +166,29 @@ def test_12_gardner_altman_ylabel():
164166
@pytest.mark.mpl_image_compare
165167
def test_13_multi_2group_color():
166168
return multi_2group.mean_diff.plot(color_col="Gender");
167-
168-
169-
169+
170+
171+
170172
@pytest.mark.mpl_image_compare
171173
def test_14_gardner_altman_paired_color():
172174
return two_groups_paired.mean_diff.plot(fig_size=(6, 6),
173175
color_col="Gender");
174-
175-
176+
177+
178+
176179
@pytest.mark.mpl_image_compare
177180
def test_15_change_palette_a():
178181
return multi_2group.mean_diff.plot(fig_size=(7, 6),
179182
color_col="Gender",
180183
custom_palette="Dark2");
181-
182-
184+
185+
186+
183187
@pytest.mark.mpl_image_compare
184188
def test_16_change_palette_b():
185189
return multi_2group.mean_diff.plot(custom_palette="Paired");
186-
187-
190+
191+
188192

189193
my_color_palette = {"Control 1" : "blue",
190194
"Test 1" : "purple",
@@ -203,28 +207,28 @@ def test_18_desat():
203207
return multi_2group.mean_diff.plot(custom_palette=my_color_palette,
204208
swarm_desat=0.75,
205209
halfviolin_desat=0.25);
206-
207-
208-
210+
211+
212+
209213
@pytest.mark.mpl_image_compare
210214
def test_19_dot_sizes():
211215
return multi_2group.mean_diff.plot(raw_marker_size=3,
212216
es_marker_size=12);
213-
214-
215-
216-
217+
218+
219+
217220
@pytest.mark.mpl_image_compare
218221
def test_20_change_ylims():
219222
return multi_2group.mean_diff.plot(swarm_ylim=(0, 5),
220223
contrast_ylim=(-2, 2));
221-
222-
224+
225+
226+
223227
@pytest.mark.mpl_image_compare
224228
def test_21_invert_ylim():
225229
return multi_2group.mean_diff.plot(contrast_ylim=(2, -2),
226230
contrast_label="More negative is better!");
227-
231+
228232

229233

230234
@pytest.mark.mpl_image_compare
@@ -242,9 +246,9 @@ def test_22_ticker_gardner_altman():
242246
contrast_axes.yaxis.set_minor_locator(Ticker.MultipleLocator(0.25))
243247

244248
return f
245-
246-
247-
249+
250+
251+
248252
@pytest.mark.mpl_image_compare
249253
def test_23_ticker_cumming():
250254
f = multi_2group.mean_diff.plot(swarm_ylim=(0,6),
@@ -260,11 +264,52 @@ def test_23_ticker_cumming():
260264
contrast_axes.yaxis.set_minor_locator(Ticker.MultipleLocator(0.25))
261265

262266
return f
263-
264-
265-
267+
268+
269+
270+
np.random.seed(9999)
271+
Ns = [20, 10, 21, 20]
272+
c1 = pd.DataFrame({'Control':norm.rvs(loc=3, scale=0.4, size=Ns[0])})
273+
t1 = pd.DataFrame({'Test 1': norm.rvs(loc=3.5, scale=0.5, size=Ns[1])})
274+
t2 = pd.DataFrame({'Test 2': norm.rvs(loc=2.5, scale=0.6, size=Ns[2])})
275+
t3 = pd.DataFrame({'Test 3': norm.rvs(loc=3, scale=0.75, size=Ns[3])})
276+
wide_df = pd.concat([c1, t1, t2, t3],axis=1)
277+
278+
279+
long_df = pd.melt(wide_df,
280+
value_vars=["Control", "Test 1", "Test 2", "Test 3"],
281+
value_name="value",
282+
var_name="group")
283+
long_df['dummy'] = np.repeat(np.nan, len(long_df))
284+
285+
286+
266287
@pytest.mark.mpl_image_compare
267-
def test_25_style_sheets():
288+
def test_24_test_wide_df_nan():
289+
290+
wide_df_dabest = load(wide_df,
291+
idx=("Control", "Test 1", "Test 2", "Test 3")
292+
)
293+
294+
return wide_df_dabest.mean_diff.plot();
295+
296+
297+
298+
@pytest.mark.mpl_image_compare
299+
def test_25_test_long_df_nan():
300+
301+
long_df_dabest = load(long_df, x="group", y="value",
302+
idx=("Control", "Test 1", "Test 2", "Test 3")
303+
)
304+
305+
return long_df_dabest.mean_diff.plot();
306+
307+
308+
309+
@pytest.mark.mpl_image_compare
310+
def test_99_style_sheets():
311+
# Perform this test last so we don't have to reset the plot style.
268312
plt.style.use("dark_background")
269313

270-
return multi_2group.mean_diff.plot();
314+
return multi_2group.mean_diff.plot();
315+

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
# The short X.Y version.
7878
version = '0.2'
7979
# The full version, including alpha/beta/rc tags.
80-
release = '0.2.6'
80+
release = '0.2.7'
8181

8282
# The language for content autogenerated by Sphinx. Refer to documentation
8383
# for a list of supported languages.

docs/source/index.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ Analyze your data with estimation statistics!
1919
News
2020
----
2121
October 2019:
22-
- v0.2.6 released. This release has one new feature (plotting of estimation plot inside any :py:mod:`matplotlib` :py:class:`Axes`; see the section on :ref:`inset_plot` in the :doc:`tutorial`). There are also two bug patches for the handling of bootstrap plotting, and of dependency installation. For more information, see the :doc:`release-notes`.
22+
- v0.2.7 released. A minor bugfix in the handling of wide datasets with unequal Ns in each group. For more information, see the :doc:`release-notes`.
23+
- v0.2.6 released. This release has one new feature (plotting of estimation plot inside any :py:mod:`matplotlib` :py:class:`Axes`; see the section on :ref:`inset_plot` in the :doc:`tutorial`). There are also two bug patches for the handling of bootstrap plotting, and of dependency installation.
2324

2425
September 2019:
2526
- v0.2.5 released. This release addresses two feature requests, and also patches two bugs: one affecting the paired difference CIs, and one involving NaNs in unused/irrelevant columns.

0 commit comments

Comments
 (0)