From 329e25639835fd7b635a9175bf1b53017efd3c9d Mon Sep 17 00:00:00 2001 From: "Joses W. Ho" Date: Thu, 7 Dec 2017 18:21:22 +0800 Subject: [PATCH 1/7] pinpoint locus of error... --- dabest/main.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dabest/main.py b/dabest/main.py index 2c45ae7e..5e3b2816 100644 --- a/dabest/main.py +++ b/dabest/main.py @@ -367,13 +367,13 @@ def plot(data, idx, # CREATE COLOR PALETTE TO NORMALIZE PALETTE ACROSS AXES. if color_col is None: - if isinstance(melted_data_in[x], pd.Series) is False: - raise AttributeError(melted_data_in[x].dtype) - color_groups = melted_data_in[x].unique() + if isinstance(data_in[x], pd.Series) is False: + raise AttributeError(data_in[x].dtype) + color_groups = data_in[x].unique() else: - if isinstance(melted_data_in[color_col], pd.Series) is False: - raise AttributeError(melted_data_in[color_col].dtype) - color_groups = melted_data_in[color_col].unique() + if isinstance(data_in[color_col], pd.Series) is False: + raise AttributeError(data_in[color_col].dtype) + color_groups = data_in[color_col].unique() if custom_palette is None: plotPal=dict( zip( color_groups, From e56d6d85fd64be479ad5e5571bf56ca355f05c81 Mon Sep 17 00:00:00 2001 From: "Joses W. Ho" Date: Thu, 7 Dec 2017 18:21:22 +0800 Subject: [PATCH 2/7] pinpoint locus of error... --- dabest/main.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dabest/main.py b/dabest/main.py index 2c45ae7e..5e3b2816 100644 --- a/dabest/main.py +++ b/dabest/main.py @@ -367,13 +367,13 @@ def plot(data, idx, # CREATE COLOR PALETTE TO NORMALIZE PALETTE ACROSS AXES. if color_col is None: - if isinstance(melted_data_in[x], pd.Series) is False: - raise AttributeError(melted_data_in[x].dtype) - color_groups = melted_data_in[x].unique() + if isinstance(data_in[x], pd.Series) is False: + raise AttributeError(data_in[x].dtype) + color_groups = data_in[x].unique() else: - if isinstance(melted_data_in[color_col], pd.Series) is False: - raise AttributeError(melted_data_in[color_col].dtype) - color_groups = melted_data_in[color_col].unique() + if isinstance(data_in[color_col], pd.Series) is False: + raise AttributeError(data_in[color_col].dtype) + color_groups = data_in[color_col].unique() if custom_palette is None: plotPal=dict( zip( color_groups, From 9122cbff787dddf7dbcc7161f64d2a81177f3730 Mon Sep 17 00:00:00 2001 From: "Joses W. Ho" Date: Thu, 7 Dec 2017 19:11:16 +0800 Subject: [PATCH 3/7] bump v0.0.2 --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index a4308e90..474a7f12 100644 --- a/setup.py +++ b/setup.py @@ -46,8 +46,8 @@ def check_dependencies(): setup(name='dabest', author='Joses Ho', author_email='joseshowh@gmail.com', - version='0.0.1', - description='Calculation and Visualization of Confidence Intervals and Effect Sizes for Python.', + version='0.0.2', + description='Data Analysis and Visualization using Bootstrapped Estimation.', packages=find_packages(), install_requires=installs, url='http://github.com/josesho/bootstrap_contrast', From 9e0fec15a30b85ec396c6f7381080abbda911630 Mon Sep 17 00:00:00 2001 From: "Joses W. Ho" Date: Thu, 7 Dec 2017 19:11:44 +0800 Subject: [PATCH 4/7] bump pandas>=0.21.0 --- setup.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 474a7f12..ff0f08be 100644 --- a/setup.py +++ b/setup.py @@ -29,10 +29,10 @@ def check_dependencies(): to_install.append('matplotlib==2.0.2') try: import pandas - if int(pandas.__version__.split('.')[1])<20: - to_install.append('pandas==0.20.3') + if int(pandas.__version__.split('.')[1])<21: + to_install.append('pandas>=0.21.0') except ImportError: - to_install.append('pandas==0.20.3') + to_install.append('pandas>=0.21.0') try: import seaborn except ImportError: From 47c9436c1c63b8308505bbc99de5bb2395d2e7e4 Mon Sep 17 00:00:00 2001 From: "Joses W. Ho" Date: Thu, 7 Dec 2017 19:12:01 +0800 Subject: [PATCH 5/7] removed stray comma.... --- dabest/main.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/dabest/main.py b/dabest/main.py index a0e8530a..0e56924c 100644 --- a/dabest/main.py +++ b/dabest/main.py @@ -237,18 +237,31 @@ def plot(data, idx, y = 'value' else: y = str(swarm_label) + if color_col is None: idv = ['index'] + turn_to_cat = [x] else: - idv = ['index',color_col] + idv = ['index', color_col] + turn_to_cat = [x, color_col] + data_in = pd.melt(data_in.reset_index(), id_vars=idv, value_vars=all_plot_groups, value_name=y, var_name=x) - idv.append(x) - idv.append(y) - data_in.columns = [idv] + + for c in turn_to_cat: + data_in.loc[:,c] = pd.Categorical(data_in[c], + categories=data_in[c].unique(), + ordered=True) + # if color_col is not None: + # data_in.loc[:,color_col] = pd.Categorical(data_in[color_col], + # categories=data_in[color_col]unique(), + # ordered=False) + # idv.append(x) + # idv.append(y) + # data_in.columns = [idv] # CALCULATE CI. if ci < 0 or ci > 100: From e9d72677dab236eca97804c019f729a5cb086c46 Mon Sep 17 00:00:00 2001 From: "Joses W. Ho" Date: Thu, 7 Dec 2017 19:12:26 +0800 Subject: [PATCH 6/7] make the `x` column categorical. --- dabest/main.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/dabest/main.py b/dabest/main.py index 0e56924c..7f3fd20b 100644 --- a/dabest/main.py +++ b/dabest/main.py @@ -437,11 +437,10 @@ def plot(data, idx, # FOR EACH TUPLE IN IDX, CREATE PLOT. for j, current_tuple in enumerate(idx): - plotdat=data_in[data_in[x].isin(current_tuple)].copy() - plotdat.loc[:,x] = plotdat[x].astype("category") - plotdat[x].cat.set_categories(current_tuple, - ordered=True, - inplace=True) + plotdat = data_in[data_in[x].isin(current_tuple)].copy() + plotdat.loc[:,x] = pd.Categorical(plotdat[x], + categories=current_tuple, + ordered=True) plotdat.sort_values(by=[x]) summaries = plotdat.groupby(x)[y].apply(stat_func) # Compute Ns per group. From d305db76e458b93af0867a3226ddf68b0a73822f Mon Sep 17 00:00:00 2001 From: "Joses W. Ho" Date: Thu, 7 Dec 2017 19:12:57 +0800 Subject: [PATCH 7/7] pandas version bump for README; scipy bump to 1.0.0 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b21dc672..c769703b 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,8 @@ In addition, the following packages are also required: - matplotlib (2.0.2) - seaborn (0.8) - numpy (1.13.1) -- scipy (0.19.1) -- pandas (0.20.3). +- scipy (1.0.0) +- pandas (0.21.0). To obtain these package dependencies easily, it is highly recommended to download the Anaconda distribution of Python from [https://www.continuum.io/downloads](https://www.continuum.io/downloads).