1
1
import numpy as np
2
2
import pandas as pd
3
3
import pandas .util .testing as tm
4
- from pandas .core .dtypes .concat import union_categoricals
4
+ try :
5
+ from pandas .api .types import union_categoricals
6
+ except ImportError :
7
+ try :
8
+ from pandas .types .concat import union_categoricals
9
+ except ImportError :
10
+ pass
5
11
6
12
7
13
class Concat (object ):
@@ -42,22 +48,22 @@ def setup(self):
42
48
self .values_some_nan = list (np .tile (self .categories + [np .nan ], N ))
43
49
self .values_all_nan = [np .nan ] * len (self .values )
44
50
45
- def time_constructor_regular (self ):
51
+ def time_regular (self ):
46
52
pd .Categorical (self .values , self .categories )
47
53
48
- def time_constructor_fastpath (self ):
54
+ def time_fastpath (self ):
49
55
pd .Categorical (self .codes , self .cat_idx , fastpath = True )
50
56
51
- def time_constructor_datetimes (self ):
57
+ def time_datetimes (self ):
52
58
pd .Categorical (self .datetimes )
53
59
54
- def time_constructor_datetimes_with_nat (self ):
60
+ def time_datetimes_with_nat (self ):
55
61
pd .Categorical (self .datetimes_with_nat )
56
62
57
- def time_constructor_with_nan (self ):
63
+ def time_with_nan (self ):
58
64
pd .Categorical (self .values_some_nan )
59
65
60
- def time_constructor_all_nan (self ):
66
+ def time_all_nan (self ):
61
67
pd .Categorical (self .values_all_nan )
62
68
63
69
@@ -73,10 +79,9 @@ def setup(self, dropna):
73
79
np .random .seed (2718281 )
74
80
arr = ['s%04d' % i for i in np .random .randint (0 , n // 10 , size = n )]
75
81
self .ts = pd .Series (arr ).astype ('category' )
76
- self .dropna = dropna
77
82
78
83
def time_value_counts (self , dropna ):
79
- self .ts .value_counts (dropna = self . dropna )
84
+ self .ts .value_counts (dropna = dropna )
80
85
81
86
82
87
class Repr (object ):
0 commit comments