From 8e77ddd17a391bef3a59b8209982623c54d56ceb Mon Sep 17 00:00:00 2001 From: Josef Perktold Date: Sat, 16 Aug 2014 06:40:26 -0400 Subject: [PATCH 1/3] BUG: MultiComparison use array for groups closes #1890 --- statsmodels/sandbox/stats/multicomp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/statsmodels/sandbox/stats/multicomp.py b/statsmodels/sandbox/stats/multicomp.py index 0456b5c5ecb..9e8a8c8c5fb 100644 --- a/statsmodels/sandbox/stats/multicomp.py +++ b/statsmodels/sandbox/stats/multicomp.py @@ -784,7 +784,7 @@ class MultiComparison(object): def __init__(self, data, groups, group_order=None): self.data = np.asarray(data) - self.groups = np.asarray(groups) + self.groups = groups = np.asarray(groups) # Allow for user-provided sorting of groups if group_order is None: From 6748b3072abeba9ec7596783eb4bd9a3843425ef Mon Sep 17 00:00:00 2001 From: Josef Perktold Date: Sat, 16 Aug 2014 16:37:16 -0400 Subject: [PATCH 2/3] TST: add tukeyhsd/MultiComparison test with pandas.Series --- statsmodels/stats/tests/test_pairwise.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/statsmodels/stats/tests/test_pairwise.py b/statsmodels/stats/tests/test_pairwise.py index 71f22f882b7..dd281ab561e 100644 --- a/statsmodels/stats/tests/test_pairwise.py +++ b/statsmodels/stats/tests/test_pairwise.py @@ -227,6 +227,17 @@ def test_table_names_custom_group_order(self): assert_((first_group, second_group) == expected_order[i - 1]) +class TestTuckeyHSD2Pandas(TestTuckeyHSD2): + + @classmethod + def setup_class(self): + super(TestTuckeyHSD2Pandas, self).setup_class() + + import pandas + self.endog = pandas.Series(self.endog) + self.groups = pandas.Series(self.groups) + + class TestTuckeyHSD2s(CheckTuckeyHSDMixin): @classmethod def setup_class(self): From c8bde0fcb0ecd180e67676cb8f68a968d04ca1ed Mon Sep 17 00:00:00 2001 From: Josef Perktold Date: Sat, 16 Aug 2014 18:27:22 -0400 Subject: [PATCH 3/3] BUG: work with bytes, use dtype object in pandas.Series --- statsmodels/stats/tests/test_pairwise.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/statsmodels/stats/tests/test_pairwise.py b/statsmodels/stats/tests/test_pairwise.py index dd281ab561e..7dedac34c8e 100644 --- a/statsmodels/stats/tests/test_pairwise.py +++ b/statsmodels/stats/tests/test_pairwise.py @@ -235,7 +235,8 @@ def setup_class(self): import pandas self.endog = pandas.Series(self.endog) - self.groups = pandas.Series(self.groups) + # we are working with bytes on python 3, not with strings in this case + self.groups = pandas.Series(self.groups, dtype=object) class TestTuckeyHSD2s(CheckTuckeyHSDMixin):