Ejemplo n.º 1
0
    def test__maybe_make_grouper_single_groupby(self):
        from cupcake.smush.base import SmushPlotterBase

        p = SmushPlotterBase()
        p.establish_variables(self.data)

        test_grouper = p._maybe_make_grouper('o', None, str)
        true_grouper = pd.Series(['o']*self.matrix.shape[0],
                                 index=self.data.index)
        pdt.assert_series_equal(test_grouper, true_grouper)
Ejemplo n.º 2
0
    def test__maybe_make_grouper_single_groupby(self):
        from cupcake.smush.base import SmushPlotterBase

        p = SmushPlotterBase()
        p.establish_variables(self.data)

        test_grouper = p._maybe_make_grouper('o', None, str)
        true_grouper = pd.Series(['o'] * self.matrix.shape[0],
                                 index=self.data.index)
        pdt.assert_series_equal(test_grouper, true_grouper)
Ejemplo n.º 3
0
    def test__maybe_make_grouper_multiple_groupbys(self):
        from cupcake.smush.base import SmushPlotterBase

        p = SmushPlotterBase()
        p.establish_variables(self.data)

        half = int(self.nrow/2.)
        groupby = pd.Series((['B'] * half) + (['A'] * half))
        order = ['A', 'B']

        test_grouper = p._maybe_make_grouper(groupby, order, str)
        true_grouper = pd.Series(pd.Categorical(groupby, categories=order,
                                      ordered=True), index=self.data.index)
        pdt.assert_series_equal(test_grouper, true_grouper)
Ejemplo n.º 4
0
    def test__maybe_make_grouper_multiple_groupbys(self):
        from cupcake.smush.base import SmushPlotterBase

        p = SmushPlotterBase()
        p.establish_variables(self.data)

        half = int(self.nrow / 2.)
        groupby = pd.Series((['B'] * half) + (['A'] * half))
        order = ['A', 'B']

        test_grouper = p._maybe_make_grouper(groupby, order, str)
        true_grouper = pd.Series(pd.Categorical(groupby,
                                                categories=order,
                                                ordered=True),
                                 index=self.data.index)
        pdt.assert_series_equal(test_grouper, true_grouper)