Example #1
0
    def test_index_properties_dtype(self):
        pi = pd.Index([1, 2, 3])
        oi = orca.Index([1, 2, 3])
        self.assertEqual(pi.dtype, oi.dtype)

        pi = pd.Index([1.0, 2, 3])
        oi = pd.Index([1.0, 2, 3])
        self.assertEqual(pi.dtype, oi.dtype)

        pi = pd.Index(['a', 'b'], dtype=str)
        oi = pd.Index(['a', 'b'], dtype=str)
        self.assertEqual(pi.dtype, oi.dtype)

        pi = pd.Index([pd.to_datetime('1/1/2018'), pd.to_datetime('2/1/2018')])
        oi = pd.Index([pd.to_datetime('1/1/2018'), pd.to_datetime('2/1/2018')])
        self.assertEqual(pi.dtype, oi.dtype)
        # dtype.str
        pi = pd.Index([1, 2, 3])
        oi = orca.Index([1, 2, 3])
        self.assertEqual(pi.dtype.str, oi.dtype.str)

        pi = pd.Index([1.0, 2, 3])
        oi = pd.Index([1.0, 2, 3])
        self.assertEqual(pi.dtype.str, oi.dtype.str)

        pi = pd.Index(['a', 'b'], dtype=str)
        oi = pd.Index(['a', 'b'], dtype=str)
        self.assertEqual(pi.dtype.str, oi.dtype.str)

        pi = pd.Index([pd.to_datetime('1/1/2018'), pd.to_datetime('2/1/2018')])
        oi = pd.Index([pd.to_datetime('1/1/2018'), pd.to_datetime('2/1/2018')])
        self.assertEqual(pi.dtype.str, oi.dtype.str)
Example #2
0
    def test_index_properties_has_duplicates(self):
        pi = pd.Index([1, 2, 3])
        oi = orca.Index([1, 2, 3])
        # TODO:NOT IMPLEMENTED
        # self.assertEqual(pi.has_duplicates, oi.has_duplicates)

        pi = pd.Index([1, 1, 1])
        oi = orca.Index([1, 1, 1])
Example #3
0
    def test_index_properties_is_hasnans(self):
        pi = pd.Index([1, 2, 3])
        oi = orca.Index([1, 2, 3])
        self.assertEqual(pi.hasnans, oi.hasnans)

        pi = pd.Index([1, np.nan, 1])
        oi = orca.Index([1, np.nan, 1])
        self.assertEqual(pi.hasnans, oi.hasnans)
Example #4
0
    def test_index_properties_is_unique(self):
        pi = pd.Index([1, 2, 3])
        oi = orca.Index([1, 2, 3])
        # FIXME:BUG
        # self.assertEqual(pi.is_unique, oi.is_unique)

        pi = pd.Index([1, 1, 1])
        oi = orca.Index([1, 1, 1])
Example #5
0
    def test_index_properties_inferred_type(self):
        pi = pd.Index([1, 2, 3])
        oi = orca.Index([1, 2, 3])
        # TODO:NOT IMPLEMENTED
        # self.assertEqual(pi.inferred_type, oi.inferred_type)

        pi = pd.Index([1.0, 2, 3])
        oi = orca.Index([1.0, 2, 3])
        # self.assertEqual(pi.inferred_type, oi.inferred_type)

        pi = pd.Index(['a', 'b'], dtype=str)
        oi = orca.Index(['a', 'b'], dtype=str)
        # self.assertEqual(pi.inferred_type, oi.inferred_type)

        pi = pd.Index([pd.to_datetime('1/1/2018'), pd.to_datetime('2/1/2018')])
        oi = orca.Index([pd.to_datetime('1/1/2018'), pd.to_datetime('2/1/2018')])
Example #6
0
    def test_index_properties_is_all_dates(self):
        pi = pd.Index([1, 2, 3])
        oi = orca.Index([1, 2, 3])
        self.assertEqual(pi.is_all_dates, oi.is_all_dates)

        pi = pd.Index([1.0, 2, 3])
        oi = pd.Index([1.0, 2, 3])
        self.assertEqual(pi.is_all_dates, oi.is_all_dates)

        pi = pd.Index(['a', 'b'], dtype=str)
        oi = pd.Index(['a', 'b'], dtype=str)
        self.assertEqual(pi.is_all_dates, oi.is_all_dates)

        pi = pd.Index([pd.to_datetime('1/1/2018'), pd.to_datetime('2/1/2018')])
        oi = pd.Index([pd.to_datetime('1/1/2018'), pd.to_datetime('2/1/2018')])
        self.assertEqual(pi.is_all_dates, oi.is_all_dates)
Example #7
0
 def test_index_properties_is_monotonic_decreasing(self):
     pi = pd.Index([1, 2, 3])
     oi = orca.Index([1, 2, 3])
     self.assertEqual(pi.is_monotonic_decreasing, oi.is_monotonic_decreasing)
Example #8
0
 def test_index_properties_memory_usage(self):
     pi = pd.Index([1, 2, 3], name=['a', 'b', 'c'])
     oi = orca.Index([1, 2, 3], name=['a', 'b', 'c'])
Example #9
0
 def test_index_properties_T(self):
     pi = pd.Index([1, 2, 3], name='a')
     oi = orca.Index([1, 2, 3], name='a')
     assert_index_equal(pi.T, oi.T.to_pandas())
Example #10
0
 def test_index_properties_empty(self):
     pi = pd.Index([1, 2, 3], name=['a', 'b', 'c'])
     oi = orca.Index([1, 2, 3], name=['a', 'b', 'c'])
Example #11
0
 def test_index_properties_values(self):
     pi = pd.Index([1, 2, 3])
     oi = orca.Index([1, 2, 3])
     self.assertEqual(repr(pi.values), repr(oi.values))
Example #12
0
 def test_index_properties_size(self):
     pi = pd.Index([1, 2, 3], name=['a', 'b', 'c'])
     oi = orca.Index([1, 2, 3], name=['a', 'b', 'c'])
     self.assertEqual(pi.size, oi.size)
Example #13
0
 def test_index_properties_shape(self):
     pi = pd.Index([1, 2, 3])
     oi = orca.Index([1, 2, 3])
     self.assertEqual(pi.shape, oi.shape)
Example #14
0
 def test_index(self):
     pi = pd.Index([1, 2, 3])
     oi = orca.Index([1, 2, 3])
     assert_index_equal(pi, oi.to_pandas())