コード例 #1
0
 def test_compression_blosc(self):
     try:
         import blosc
     except ImportError:
         raise nose.SkipTest('no blosc')
     i_rec = self.encode_decode(self.frame, compress='blosc')
     for k in self.frame.keys():
         assert_frame_equal(self.frame[k], i_rec[k])
コード例 #2
0
ファイル: test_packers.py プロジェクト: scarrucciu/pandas
 def test_compression_blosc(self):
     try:
         import blosc
     except ImportError:
         raise nose.SkipTest("no blosc")
     i_rec = self.encode_decode(self.frame, compress="blosc")
     for k in self.frame.keys():
         assert_frame_equal(self.frame[k], i_rec[k])
コード例 #3
0
ファイル: test_packers.py プロジェクト: trailsquirrel/pandas
    def tests_datetimeindex_freq_issue(self):

        # GH 5947
        # inferring freq on the datetimeindex
        df = DataFrame([1, 2, 3], index=date_range('1/1/2013', '1/3/2013'))
        result = self.encode_decode(df)
        assert_frame_equal(result, df)

        df = DataFrame([1, 2], index=date_range('1/1/2013', '1/2/2013'))
        result = self.encode_decode(df)
        assert_frame_equal(result, df)
コード例 #4
0
ファイル: test_packers.py プロジェクト: scarrucciu/pandas
    def tests_datetimeindex_freq_issue(self):

        # GH 5947
        # inferring freq on the datetimeindex
        df = DataFrame([1, 2, 3], index=date_range("1/1/2013", "1/3/2013"))
        result = self.encode_decode(df)
        assert_frame_equal(result, df)

        df = DataFrame([1, 2], index=date_range("1/1/2013", "1/2/2013"))
        result = self.encode_decode(df)
        assert_frame_equal(result, df)
コード例 #5
0
ファイル: test_packers.py プロジェクト: trailsquirrel/pandas
def check_arbitrary(a, b):

    if isinstance(a, (list, tuple)) and isinstance(b, (list, tuple)):
        assert (len(a) == len(b))
        for a_, b_ in zip(a, b):
            check_arbitrary(a_, b_)
    elif isinstance(a, Panel):
        assert_panel_equal(a, b)
    elif isinstance(a, DataFrame):
        assert_frame_equal(a, b)
    elif isinstance(a, Series):
        assert_series_equal(a, b)
    else:
        assert (a == b)
コード例 #6
0
ファイル: test_packers.py プロジェクト: Acanthostega/pandas
def check_arbitrary(a, b):

    if isinstance(a, (list, tuple)) and isinstance(b, (list, tuple)):
        assert(len(a) == len(b))
        for a_, b_ in zip(a, b):
            check_arbitrary(a_, b_)
    elif isinstance(a, Panel):
        assert_panel_equal(a, b)
    elif isinstance(a, DataFrame):
        assert_frame_equal(a, b)
    elif isinstance(a, Series):
        assert_series_equal(a, b)
    else:
        assert(a == b)
コード例 #7
0
ファイル: test_packers.py プロジェクト: scarrucciu/pandas
    def test_multi(self):

        i_rec = self.encode_decode(self.frame)
        for k in self.frame.keys():
            assert_frame_equal(self.frame[k], i_rec[k])

        l = tuple([self.frame["float"], self.frame["float"].A, self.frame["float"].B, None])
        l_rec = self.encode_decode(l)
        check_arbitrary(l, l_rec)

        # this is an oddity in that packed lists will be returned as tuples
        l = [self.frame["float"], self.frame["float"].A, self.frame["float"].B, None]
        l_rec = self.encode_decode(l)
        self.assertIsInstance(l_rec, tuple)
        check_arbitrary(l, l_rec)
コード例 #8
0
    def test_multi(self):

        i_rec = self.encode_decode(self.frame)
        for k in self.frame.keys():
            assert_frame_equal(self.frame[k], i_rec[k])

        l = tuple(
            [self.frame['float'], self.frame['float'].A, self.frame['float'].B, None])
        l_rec = self.encode_decode(l)
        check_arbitrary(l, l_rec)

        # this is an oddity in that packed lists will be returned as tuples
        l = [self.frame['float'], self.frame['float']
             .A, self.frame['float'].B, None]
        l_rec = self.encode_decode(l)
        self.assertIsInstance(l_rec, tuple)
        check_arbitrary(l, l_rec)
コード例 #9
0
ファイル: test_pytables.py プロジェクト: MarkyV/pandas
    def test_tseries_indices_frame(self):
        idx = tm.makeDateIndex(10)
        df = DataFrame(np.random.randn(len(idx), 3), index=idx)
        self.store['a'] = df
        result = self.store['a']

        assert_frame_equal(result, df)
        self.assertEquals(type(result.index), type(df.index))
        self.assertEquals(result.index.freq, df.index.freq)

        idx = tm.makePeriodIndex(10)
        df = DataFrame(np.random.randn(len(idx), 3), idx)
        self.store['a'] = df
        result = self.store['a']

        assert_frame_equal(result, df)
        self.assertEquals(type(result.index), type(df.index))
        self.assertEquals(result.index.freq, df.index.freq)
コード例 #10
0
ファイル: test_pytables.py プロジェクト: andreas-h/pandas
    def test_tseries_indices_frame(self):
        idx = tm.makeDateIndex(10)
        df = DataFrame(np.random.randn(len(idx), 3), index=idx)
        self.store['a'] = df
        result = self.store['a']

        assert_frame_equal(result, df)
        self.assertEquals(type(result.index), type(df.index))
        self.assertEquals(result.index.freq, df.index.freq)

        idx = tm.makePeriodIndex(10)
        df = DataFrame(np.random.randn(len(idx), 3), idx)
        self.store['a'] = df
        result = self.store['a']

        assert_frame_equal(result, df)
        self.assertEquals(type(result.index), type(df.index))
        self.assertEquals(result.index.freq, df.index.freq)
コード例 #11
0
    def test_dataframe_duplicate_column_names(self):

        # GH 9618
        expected_1 = DataFrame(columns=['a', 'a'])
        expected_2 = DataFrame(columns=[1] * 100)
        expected_2.loc[0] = np.random.randn(100)
        expected_3 = DataFrame(columns=[1, 1])
        expected_3.loc[0] = ['abc', np.nan]

        result_1 = self.encode_decode(expected_1)
        result_2 = self.encode_decode(expected_2)
        result_3 = self.encode_decode(expected_3)

        assert_frame_equal(result_1, expected_1)
        assert_frame_equal(result_2, expected_2)
        assert_frame_equal(result_3, expected_3)
コード例 #12
0
ファイル: test_packers.py プロジェクト: scarrucciu/pandas
    def test_dataframe_duplicate_column_names(self):

        # GH 9618
        expected_1 = DataFrame(columns=["a", "a"])
        expected_2 = DataFrame(columns=[1] * 100)
        expected_2.loc[0] = np.random.randn(100)
        expected_3 = DataFrame(columns=[1, 1])
        expected_3.loc[0] = ["abc", np.nan]

        result_1 = self.encode_decode(expected_1)
        result_2 = self.encode_decode(expected_2)
        result_3 = self.encode_decode(expected_3)

        assert_frame_equal(result_1, expected_1)
        assert_frame_equal(result_2, expected_2)
        assert_frame_equal(result_3, expected_3)
コード例 #13
0
ファイル: test_packers.py プロジェクト: scarrucciu/pandas
 def test_utf(self):
     # GH10581
     for encoding in self.utf_encodings:
         for frame in compat.itervalues(self.frame):
             result = self.encode_decode(frame, encoding=encoding)
             assert_frame_equal(result, frame)
コード例 #14
0
ファイル: test_packers.py プロジェクト: scarrucciu/pandas
 def test_compression_zlib(self):
     i_rec = self.encode_decode(self.frame, compress="zlib")
     for k in self.frame.keys():
         assert_frame_equal(self.frame[k], i_rec[k])
コード例 #15
0
ファイル: test_packers.py プロジェクト: scarrucciu/pandas
 def test_plain(self):
     i_rec = self.encode_decode(self.frame)
     for k in self.frame.keys():
         assert_frame_equal(self.frame[k], i_rec[k])
コード例 #16
0
 def test_plain(self):
     i_rec = self.encode_decode(self.frame)
     for k in self.frame.keys():
         assert_frame_equal(self.frame[k], i_rec[k])
コード例 #17
0
 def test_compression_zlib(self):
     i_rec = self.encode_decode(self.frame, compress='zlib')
     for k in self.frame.keys():
         assert_frame_equal(self.frame[k], i_rec[k])
コード例 #18
0
ファイル: test_packers.py プロジェクト: scarrucciu/pandas
    def test_basic_frame(self):

        for s, i in self.frame.items():
            i_rec = self.encode_decode(i)
            assert_frame_equal(i, i_rec)
コード例 #19
0
 def test_utf(self):
     # GH10581
     for encoding in self.utf_encodings:
         for frame in compat.itervalues(self.frame):
             result = self.encode_decode(frame, encoding=encoding)
             assert_frame_equal(result, frame)
コード例 #20
0
ファイル: test_packers.py プロジェクト: austin-taylor/pandas
 def test_compression_blosc(self):
     i_rec = self.encode_decode(self.frame, compress='blosc')
     for k in self.frame.keys():
         assert_frame_equal(self.frame[k], i_rec[k])
コード例 #21
0
ファイル: test_packers.py プロジェクト: trailsquirrel/pandas
    def test_basic_frame(self):

        for s, i in self.frame.items():
            i_rec = self.encode_decode(i)
            assert_frame_equal(i, i_rec)