Beispiel #1
0
    def test_from_data_frame(self):

        dframe1 = DictFrame({"x": [0, 1, 2], "y": ["a", "b", "c"]})
        pdf = dframe1.todf()
        dframe2 = pd_to_dict_frame(pdf)

        assert set(pdf.columns) == set(["x", "y"])
        assert dframe1 == dframe2
Beispiel #2
0
    def test_to_data_frame(self):

        dframe = DictFrame({
            "x": [0, 1, 2],
            "y": ["a", "b", "c"],
            "embed": np.random.normal(0, 1, (3, 20)),
        })
        exp_cols = ["x", "y"] + ["embed-{0:d}".format(x) for x in range(20)]
        pdf = dframe.todf()

        assert set(pdf.columns) == set(exp_cols)
        assert issubclass(type(pdf), pd.core.frame.DataFrame)