def test_simple_dfr(self):
        """ILinePlot doesn't barf when plotting DataFrames"""
        dfr1 = pd.DataFrame([1, 2, 3, 4], columns=["a"])
        dfr2 = pd.DataFrame([2, 3, 4, 5], columns=["a"])

        trappy.ILinePlot([dfr1, dfr2], column=["a", "a"]).view(test=True)

        with self.assertRaises(ValueError):
            trappy.ILinePlot([dfr1, dfr2]).view(test=True)
Example #2
0
    def test_duplicate_merging(self):
        dfr1 = pd.DataFrame([1, 2, 3, 4],
                            index=[0., 0., 1., 2.],
                            columns=["a"])
        dfr2 = pd.DataFrame([2, 3, 4, 5],
                            index=[1., 1., 1., 2.],
                            columns=["a"])

        trappy.ILinePlot([dfr1, dfr2], column=["a", "a"]).view(test=True)
    def test_independent_series_merging(self):
        """ILinePlot fixes indexes of independent series"""
        index1 = [0., 1., 2., 3.]
        s1 = pd.Series([1, 2, 3, 4], index=index1)
        index2 = [0.5, 1.5, 2.5, 3.5]
        s2 = pd.Series([2, 3, 4, 5], index=index2)

        dfr = pd.DataFrame([0, 1, 2, 3], columns=["a"])
        iplot = trappy.ILinePlot(dfr, column=["a"])
        s = {"s1": s1, "s2": s2}
        merged = iplot._fix_indexes(s)

        expected_index = index1 + index2
        expected_index.sort()
        self.assertEquals(expected_index, sorted(merged["s1"].keys()))
Example #4
0
    def test_simple_dfr(self):
        dfr1 = pd.DataFrame([1, 2, 3, 4], columns=["a"])
        dfr2 = pd.DataFrame([2, 3, 4, 5], columns=["a"])

        trappy.ILinePlot([dfr1, dfr2], column=["a", "a"]).view(test=True)