@@ -17,7 +17,7 @@ def test_ints(self):
17
17
18
18
result = algos .match (to_match , values )
19
19
expected = np .array ([0 , 2 , 1 , 1 , 0 , 2 , - 1 , 0 ])
20
- self .assert_numpy_array_equals (result , expected )
20
+ self .assert_numpy_array_equal (result , expected )
21
21
22
22
result = Series (algos .match (to_match , values , np .nan ))
23
23
expected = Series (np .array ([0 , 2 , 1 , 1 , 0 , 2 , np .nan , 0 ]))
@@ -26,7 +26,7 @@ def test_ints(self):
26
26
s = pd .Series (np .arange (5 ),dtype = np .float32 )
27
27
result = algos .match (s , [2 ,4 ])
28
28
expected = np .array ([- 1 , - 1 , 0 , - 1 , 1 ])
29
- self .assert_numpy_array_equals (result , expected )
29
+ self .assert_numpy_array_equal (result , expected )
30
30
31
31
result = Series (algos .match (s , [2 ,4 ], np .nan ))
32
32
expected = Series (np .array ([np .nan , np .nan , 0 , np .nan , 1 ]))
@@ -38,7 +38,7 @@ def test_strings(self):
38
38
39
39
result = algos .match (to_match , values )
40
40
expected = np .array ([1 , 0 , - 1 , 0 , 1 , 2 , - 1 ])
41
- self .assert_numpy_array_equals (result , expected )
41
+ self .assert_numpy_array_equal (result , expected )
42
42
43
43
result = Series (algos .match (to_match , values , np .nan ))
44
44
expected = Series (np .array ([1 , 0 , np .nan , 0 , 1 , 2 , np .nan ]))
@@ -51,42 +51,42 @@ def test_basic(self):
51
51
52
52
labels , uniques = algos .factorize (['a' , 'b' , 'b' , 'a' ,
53
53
'a' , 'c' , 'c' , 'c' ])
54
- # self.assert_numpy_array_equals (labels, np.array([ 0, 1, 1, 0, 0, 2, 2, 2],dtype=np.int64))
55
- self .assert_numpy_array_equals (uniques , np .array (['a' ,'b' ,'c' ], dtype = object ))
54
+ # self.assert_numpy_array_equal (labels, np.array([ 0, 1, 1, 0, 0, 2, 2, 2],dtype=np.int64))
55
+ self .assert_numpy_array_equal (uniques , np .array (['a' ,'b' ,'c' ], dtype = object ))
56
56
57
57
labels , uniques = algos .factorize (['a' , 'b' , 'b' , 'a' ,
58
58
'a' , 'c' , 'c' , 'c' ], sort = True )
59
- self .assert_numpy_array_equals (labels , np .array ([ 0 , 1 , 1 , 0 , 0 , 2 , 2 , 2 ],dtype = np .int64 ))
60
- self .assert_numpy_array_equals (uniques , np .array (['a' ,'b' ,'c' ], dtype = object ))
59
+ self .assert_numpy_array_equal (labels , np .array ([ 0 , 1 , 1 , 0 , 0 , 2 , 2 , 2 ],dtype = np .int64 ))
60
+ self .assert_numpy_array_equal (uniques , np .array (['a' ,'b' ,'c' ], dtype = object ))
61
61
62
62
labels , uniques = algos .factorize (list (reversed (range (5 ))))
63
- self .assert_numpy_array_equals (labels , np .array ([0 , 1 , 2 , 3 , 4 ], dtype = np .int64 ))
64
- self .assert_numpy_array_equals (uniques , np .array ([ 4 , 3 , 2 , 1 , 0 ],dtype = np .int64 ))
63
+ self .assert_numpy_array_equal (labels , np .array ([0 , 1 , 2 , 3 , 4 ], dtype = np .int64 ))
64
+ self .assert_numpy_array_equal (uniques , np .array ([ 4 , 3 , 2 , 1 , 0 ],dtype = np .int64 ))
65
65
66
66
labels , uniques = algos .factorize (list (reversed (range (5 ))), sort = True )
67
- self .assert_numpy_array_equals (labels , np .array ([ 4 , 3 , 2 , 1 , 0 ],dtype = np .int64 ))
68
- self .assert_numpy_array_equals (uniques , np .array ([0 , 1 , 2 , 3 , 4 ], dtype = np .int64 ))
67
+ self .assert_numpy_array_equal (labels , np .array ([ 4 , 3 , 2 , 1 , 0 ],dtype = np .int64 ))
68
+ self .assert_numpy_array_equal (uniques , np .array ([0 , 1 , 2 , 3 , 4 ], dtype = np .int64 ))
69
69
70
70
labels , uniques = algos .factorize (list (reversed (np .arange (5. ))))
71
- self .assert_numpy_array_equals (labels , np .array ([0. , 1. , 2. , 3. , 4. ], dtype = np .float64 ))
72
- self .assert_numpy_array_equals (uniques , np .array ([ 4 , 3 , 2 , 1 , 0 ],dtype = np .int64 ))
71
+ self .assert_numpy_array_equal (labels , np .array ([0. , 1. , 2. , 3. , 4. ], dtype = np .float64 ))
72
+ self .assert_numpy_array_equal (uniques , np .array ([ 4 , 3 , 2 , 1 , 0 ],dtype = np .int64 ))
73
73
74
74
labels , uniques = algos .factorize (list (reversed (np .arange (5. ))), sort = True )
75
- self .assert_numpy_array_equals (labels , np .array ([ 4 , 3 , 2 , 1 , 0 ],dtype = np .int64 ))
76
- self .assert_numpy_array_equals (uniques , np .array ([0. , 1. , 2. , 3. , 4. ], dtype = np .float64 ))
75
+ self .assert_numpy_array_equal (labels , np .array ([ 4 , 3 , 2 , 1 , 0 ],dtype = np .int64 ))
76
+ self .assert_numpy_array_equal (uniques , np .array ([0. , 1. , 2. , 3. , 4. ], dtype = np .float64 ))
77
77
78
78
def test_mixed (self ):
79
79
80
80
# doc example reshaping.rst
81
81
x = Series (['A' , 'A' , np .nan , 'B' , 3.14 , np .inf ])
82
82
labels , uniques = algos .factorize (x )
83
83
84
- self .assert_numpy_array_equals (labels , np .array ([ 0 , 0 , - 1 , 1 , 2 , 3 ],dtype = np .int64 ))
85
- self .assert_numpy_array_equals (uniques , np .array (['A' , 'B' , 3.14 , np .inf ], dtype = object ))
84
+ self .assert_numpy_array_equal (labels , np .array ([ 0 , 0 , - 1 , 1 , 2 , 3 ],dtype = np .int64 ))
85
+ self .assert_numpy_array_equal (uniques , np .array (['A' , 'B' , 3.14 , np .inf ], dtype = object ))
86
86
87
87
labels , uniques = algos .factorize (x , sort = True )
88
- self .assert_numpy_array_equals (labels , np .array ([ 2 , 2 , - 1 , 3 , 0 , 1 ],dtype = np .int64 ))
89
- self .assert_numpy_array_equals (uniques , np .array ([3.14 , np .inf , 'A' , 'B' ], dtype = object ))
88
+ self .assert_numpy_array_equal (labels , np .array ([ 2 , 2 , - 1 , 3 , 0 , 1 ],dtype = np .int64 ))
89
+ self .assert_numpy_array_equal (uniques , np .array ([3.14 , np .inf , 'A' , 'B' ], dtype = object ))
90
90
91
91
def test_datelike (self ):
92
92
@@ -95,12 +95,12 @@ def test_datelike(self):
95
95
v2 = pd .Timestamp ('20130101' )
96
96
x = Series ([v1 ,v1 ,v1 ,v2 ,v2 ,v1 ])
97
97
labels , uniques = algos .factorize (x )
98
- self .assert_numpy_array_equals (labels , np .array ([ 0 ,0 ,0 ,1 ,1 ,0 ],dtype = np .int64 ))
99
- self .assert_numpy_array_equals (uniques , np .array ([v1 .value ,v2 .value ],dtype = 'M8[ns]' ))
98
+ self .assert_numpy_array_equal (labels , np .array ([ 0 ,0 ,0 ,1 ,1 ,0 ],dtype = np .int64 ))
99
+ self .assert_numpy_array_equal (uniques , np .array ([v1 .value ,v2 .value ],dtype = 'M8[ns]' ))
100
100
101
101
labels , uniques = algos .factorize (x , sort = True )
102
- self .assert_numpy_array_equals (labels , np .array ([ 1 ,1 ,1 ,0 ,0 ,1 ],dtype = np .int64 ))
103
- self .assert_numpy_array_equals (uniques , np .array ([v2 .value ,v1 .value ],dtype = 'M8[ns]' ))
102
+ self .assert_numpy_array_equal (labels , np .array ([ 1 ,1 ,1 ,0 ,0 ,1 ],dtype = np .int64 ))
103
+ self .assert_numpy_array_equal (uniques , np .array ([v2 .value ,v1 .value ],dtype = 'M8[ns]' ))
104
104
105
105
# period
106
106
v1 = pd .Period ('201302' ,freq = 'M' )
@@ -109,12 +109,12 @@ def test_datelike(self):
109
109
110
110
# periods are not 'sorted' as they are converted back into an index
111
111
labels , uniques = algos .factorize (x )
112
- self .assert_numpy_array_equals (labels , np .array ([ 0 ,0 ,0 ,1 ,1 ,0 ],dtype = np .int64 ))
113
- self .assert_numpy_array_equals (uniques , np .array ([v1 , v2 ],dtype = object ))
112
+ self .assert_numpy_array_equal (labels , np .array ([ 0 ,0 ,0 ,1 ,1 ,0 ],dtype = np .int64 ))
113
+ self .assert_numpy_array_equal (uniques , np .array ([v1 , v2 ],dtype = object ))
114
114
115
115
labels , uniques = algos .factorize (x ,sort = True )
116
- self .assert_numpy_array_equals (labels , np .array ([ 0 ,0 ,0 ,1 ,1 ,0 ],dtype = np .int64 ))
117
- self .assert_numpy_array_equals (uniques , np .array ([v1 , v2 ],dtype = object ))
116
+ self .assert_numpy_array_equal (labels , np .array ([ 0 ,0 ,0 ,1 ,1 ,0 ],dtype = np .int64 ))
117
+ self .assert_numpy_array_equal (uniques , np .array ([v1 , v2 ],dtype = object ))
118
118
119
119
class TestUnique (tm .TestCase ):
120
120
_multiprocess_can_split_ = True
0 commit comments