Python pandas.util.testing.assert_class_equal() Examples

The following are 20 code examples of pandas.util.testing.assert_class_equal(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module pandas.util.testing , or try the search function .
Example #1
Source File: test_packers.py    From predictive-maintenance-using-machine-learning with Apache License 2.0 5 votes vote down vote up
def test_dict_complex(self):
        x = {'foo': 1.0 + 1.0j, 'bar': 2.0 + 2.0j}
        x_rec = self.encode_decode(x)
        tm.assert_dict_equal(x, x_rec)

        for key in x:
            tm.assert_class_equal(x[key], x_rec[key], obj="complex value") 
Example #2
Source File: test_frame.py    From twitter-stock-recommendation with MIT License 5 votes vote down vote up
def test_iloc(self):

        # 2227
        result = self.frame.iloc[:, 0]
        assert isinstance(result, SparseSeries)
        tm.assert_sp_series_equal(result, self.frame['A'])

        # preserve sparse index type. #2251
        data = {'A': [0, 1]}
        iframe = SparseDataFrame(data, default_kind='integer')
        tm.assert_class_equal(iframe['A'].sp_index,
                              iframe.iloc[:, 0].sp_index) 
Example #3
Source File: test_indexing.py    From twitter-stock-recommendation with MIT License 5 votes vote down vote up
def test_series_indexing_single(self):
        for i, idx in enumerate(self.cols):
            assert self.ss.iloc[i] == self.ss[idx]
            tm.assert_class_equal(self.ss.iloc[i], self.ss[idx],
                                  obj="series index")

        assert self.ss['string'] == 'a'
        assert self.ss['int'] == 1
        assert self.ss['float'] == 1.1
        assert self.ss['object'] == [] 
Example #4
Source File: test_frame.py    From coffeegrindsize with MIT License 5 votes vote down vote up
def test_iloc(self, float_frame):

        # GH 2227
        result = float_frame.iloc[:, 0]
        assert isinstance(result, SparseSeries)
        tm.assert_sp_series_equal(result, float_frame['A'])

        # preserve sparse index type. #2251
        data = {'A': [0, 1]}
        iframe = SparseDataFrame(data, default_kind='integer')
        tm.assert_class_equal(iframe['A'].sp_index,
                              iframe.iloc[:, 0].sp_index) 
Example #5
Source File: test_indexing.py    From coffeegrindsize with MIT License 5 votes vote down vote up
def test_series_indexing_single(self):
        for i, idx in enumerate(self.cols):
            assert self.ss.iloc[i] == self.ss[idx]
            tm.assert_class_equal(self.ss.iloc[i], self.ss[idx],
                                  obj="series index")

        assert self.ss['string'] == 'a'
        assert self.ss['int'] == 1
        assert self.ss['float'] == 1.1
        assert self.ss['object'] == [] 
Example #6
Source File: test_packers.py    From elasticintel with GNU General Public License v3.0 5 votes vote down vote up
def test_dict_numpy_complex(self):
        x = {'foo': np.complex128(1.0 + 1.0j),
             'bar': np.complex128(2.0 + 2.0j)}
        x_rec = self.encode_decode(x)
        tm.assert_dict_equal(x, x_rec)

        for key in x:
            tm.assert_class_equal(x[key], x_rec[key], obj="numpy complex128") 
Example #7
Source File: test_packers.py    From elasticintel with GNU General Public License v3.0 5 votes vote down vote up
def test_dict_complex(self):
        x = {'foo': 1.0 + 1.0j, 'bar': 2.0 + 2.0j}
        x_rec = self.encode_decode(x)
        tm.assert_dict_equal(x, x_rec)

        for key in x:
            tm.assert_class_equal(x[key], x_rec[key], obj="complex value") 
Example #8
Source File: test_frame.py    From elasticintel with GNU General Public License v3.0 5 votes vote down vote up
def test_iloc(self):

        # 2227
        result = self.frame.iloc[:, 0]
        assert isinstance(result, SparseSeries)
        tm.assert_sp_series_equal(result, self.frame['A'])

        # preserve sparse index type. #2251
        data = {'A': [0, 1]}
        iframe = SparseDataFrame(data, default_kind='integer')
        tm.assert_class_equal(iframe['A'].sp_index,
                              iframe.iloc[:, 0].sp_index) 
Example #9
Source File: test_indexing.py    From elasticintel with GNU General Public License v3.0 5 votes vote down vote up
def test_series_indexing_single(self):
        for i, idx in enumerate(self.cols):
            assert self.ss.iloc[i] == self.ss[idx]
            tm.assert_class_equal(self.ss.iloc[i], self.ss[idx],
                                  obj="series index")

        assert self.ss['string'] == 'a'
        assert self.ss['int'] == 1
        assert self.ss['float'] == 1.1
        assert self.ss['object'] == [] 
Example #10
Source File: test_packers.py    From predictive-maintenance-using-machine-learning with Apache License 2.0 5 votes vote down vote up
def test_dict_numpy_complex(self):
        x = {'foo': np.complex128(1.0 + 1.0j),
             'bar': np.complex128(2.0 + 2.0j)}
        x_rec = self.encode_decode(x)
        tm.assert_dict_equal(x, x_rec)

        for key in x:
            tm.assert_class_equal(x[key], x_rec[key], obj="numpy complex128") 
Example #11
Source File: test_indexing.py    From recruit with Apache License 2.0 5 votes vote down vote up
def test_series_indexing_single(self):
        for i, idx in enumerate(self.cols):
            assert self.ss.iloc[i] == self.ss[idx]
            tm.assert_class_equal(self.ss.iloc[i], self.ss[idx],
                                  obj="series index")

        assert self.ss['string'] == 'a'
        assert self.ss['int'] == 1
        assert self.ss['float'] == 1.1
        assert self.ss['object'] == [] 
Example #12
Source File: test_frame.py    From predictive-maintenance-using-machine-learning with Apache License 2.0 5 votes vote down vote up
def test_iloc(self, float_frame):

        # GH 2227
        result = float_frame.iloc[:, 0]
        assert isinstance(result, SparseSeries)
        tm.assert_sp_series_equal(result, float_frame['A'])

        # preserve sparse index type. #2251
        data = {'A': [0, 1]}
        iframe = SparseDataFrame(data, default_kind='integer')
        tm.assert_class_equal(iframe['A'].sp_index,
                              iframe.iloc[:, 0].sp_index) 
Example #13
Source File: test_indexing.py    From predictive-maintenance-using-machine-learning with Apache License 2.0 5 votes vote down vote up
def test_series_indexing_single(self):
        for i, idx in enumerate(self.cols):
            assert self.ss.iloc[i] == self.ss[idx]
            tm.assert_class_equal(self.ss.iloc[i], self.ss[idx],
                                  obj="series index")

        assert self.ss['string'] == 'a'
        assert self.ss['int'] == 1
        assert self.ss['float'] == 1.1
        assert self.ss['object'] == [] 
Example #14
Source File: test_packers.py    From vnpy_crypto with MIT License 5 votes vote down vote up
def test_dict_numpy_complex(self):
        x = {'foo': np.complex128(1.0 + 1.0j),
             'bar': np.complex128(2.0 + 2.0j)}
        x_rec = self.encode_decode(x)
        tm.assert_dict_equal(x, x_rec)

        for key in x:
            tm.assert_class_equal(x[key], x_rec[key], obj="numpy complex128") 
Example #15
Source File: test_packers.py    From vnpy_crypto with MIT License 5 votes vote down vote up
def test_dict_complex(self):
        x = {'foo': 1.0 + 1.0j, 'bar': 2.0 + 2.0j}
        x_rec = self.encode_decode(x)
        tm.assert_dict_equal(x, x_rec)

        for key in x:
            tm.assert_class_equal(x[key], x_rec[key], obj="complex value") 
Example #16
Source File: test_frame.py    From vnpy_crypto with MIT License 5 votes vote down vote up
def test_iloc(self):

        # 2227
        result = self.frame.iloc[:, 0]
        assert isinstance(result, SparseSeries)
        tm.assert_sp_series_equal(result, self.frame['A'])

        # preserve sparse index type. #2251
        data = {'A': [0, 1]}
        iframe = SparseDataFrame(data, default_kind='integer')
        tm.assert_class_equal(iframe['A'].sp_index,
                              iframe.iloc[:, 0].sp_index) 
Example #17
Source File: test_indexing.py    From vnpy_crypto with MIT License 5 votes vote down vote up
def test_series_indexing_single(self):
        for i, idx in enumerate(self.cols):
            assert self.ss.iloc[i] == self.ss[idx]
            tm.assert_class_equal(self.ss.iloc[i], self.ss[idx],
                                  obj="series index")

        assert self.ss['string'] == 'a'
        assert self.ss['int'] == 1
        assert self.ss['float'] == 1.1
        assert self.ss['object'] == [] 
Example #18
Source File: test_packers.py    From recruit with Apache License 2.0 5 votes vote down vote up
def test_dict_numpy_complex(self):
        x = {'foo': np.complex128(1.0 + 1.0j),
             'bar': np.complex128(2.0 + 2.0j)}
        x_rec = self.encode_decode(x)
        tm.assert_dict_equal(x, x_rec)

        for key in x:
            tm.assert_class_equal(x[key], x_rec[key], obj="numpy complex128") 
Example #19
Source File: test_packers.py    From recruit with Apache License 2.0 5 votes vote down vote up
def test_dict_complex(self):
        x = {'foo': 1.0 + 1.0j, 'bar': 2.0 + 2.0j}
        x_rec = self.encode_decode(x)
        tm.assert_dict_equal(x, x_rec)

        for key in x:
            tm.assert_class_equal(x[key], x_rec[key], obj="complex value") 
Example #20
Source File: test_frame.py    From recruit with Apache License 2.0 5 votes vote down vote up
def test_iloc(self, float_frame):

        # GH 2227
        result = float_frame.iloc[:, 0]
        assert isinstance(result, SparseSeries)
        tm.assert_sp_series_equal(result, float_frame['A'])

        # preserve sparse index type. #2251
        data = {'A': [0, 1]}
        iframe = SparseDataFrame(data, default_kind='integer')
        tm.assert_class_equal(iframe['A'].sp_index,
                              iframe.iloc[:, 0].sp_index)