3
3
import pandas as pd
4
4
5
5
6
+ class IsinAlmostFullWithRandomInt :
7
+ params = [
8
+ [np .float64 , np .int64 , np .uint64 , np .object ],
9
+ range (10 , 21 ),
10
+ ]
11
+ param_names = ["dtype" , "exponent" ]
12
+
13
+ def setup (self , dtype , exponent ):
14
+ M = 3 * 2 ** (exponent - 2 )
15
+ # 0.77-the maximal share of occupied buckets
16
+ np .random .seed (42 )
17
+ self .s = pd .Series (np .random .randint (0 , M , M )).astype (dtype )
18
+ self .values = np .random .randint (0 , M , M ).astype (dtype )
19
+ self .values_outside = self .values + M
20
+
21
+ def time_isin (self , dtype , exponent ):
22
+ self .s .isin (self .values )
23
+
24
+ def time_isin_outside (self , dtype , exponent ):
25
+ self .s .isin (self .values_outside )
26
+
27
+
28
+ class IsinWithRandomFloat :
29
+ params = [
30
+ [np .float64 , np .object ],
31
+ [
32
+ 1_300 ,
33
+ 2_000 ,
34
+ 7_000 ,
35
+ 8_000 ,
36
+ 70_000 ,
37
+ 80_000 ,
38
+ 750_000 ,
39
+ 900_000 ,
40
+ ],
41
+ ]
42
+ param_names = ["dtype" , "M" ]
43
+
44
+ def setup (self , dtype , M ):
45
+ np .random .seed (42 )
46
+ self .values = np .random .rand (M )
47
+ self .s = pd .Series (self .values ).astype (dtype )
48
+ np .random .shuffle (self .values )
49
+ self .values_outside = self .values + 0.1
50
+
51
+ def time_isin (self , dtype , M ):
52
+ self .s .isin (self .values )
53
+
54
+ def time_isin_outside (self , dtype , M ):
55
+ self .s .isin (self .values_outside )
56
+
57
+
6
58
class IsinWithArangeSorted :
7
59
params = [
8
- [np .float64 , np .int64 , np .object ],
60
+ [np .float64 , np .int64 , np .uint64 , np . object ],
9
61
[
10
62
1_000 ,
11
63
2_000 ,
@@ -26,7 +78,7 @@ def time_isin(self, dtype, M):
26
78
27
79
class IsinWithArange :
28
80
params = [
29
- [np .float64 , np .int64 , np .object ],
81
+ [np .float64 , np .int64 , np .uint64 , np . object ],
30
82
[
31
83
1_000 ,
32
84
2_000 ,
0 commit comments