forked from pandas-dev/pandas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdtypes.py
39 lines (28 loc) · 1.07 KB
/
dtypes.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from pandas.api.types import pandas_dtype
import numpy as np
from .pandas_vb_common import (
numeric_dtypes, datetime_dtypes, string_dtypes, extension_dtypes)
_numpy_dtypes = [np.dtype(dtype)
for dtype in (numeric_dtypes +
datetime_dtypes +
string_dtypes)]
_dtypes = _numpy_dtypes + extension_dtypes
class Dtypes:
params = (_dtypes +
list(map(lambda dt: dt.name, _dtypes)))
param_names = ['dtype']
def time_pandas_dtype(self, dtype):
pandas_dtype(dtype)
class DtypesInvalid:
param_names = ['dtype']
params = ['scalar-string', 'scalar-int', 'list-string', 'array-string']
data_dict = {'scalar-string': 'foo',
'scalar-int': 1,
'list-string': ['foo'] * 1000,
'array-string': np.array(['foo'] * 1000)}
def time_pandas_dtype_invalid(self, dtype):
try:
pandas_dtype(self.data_dict[dtype])
except TypeError:
pass
from .pandas_vb_common import setup # noqa: F401