Coverage for /var/srv/projects/api.amasfac.comuna18.com/tmp/venv/lib/python3.9/site-packages/pandas/core/computation/common.py: 40%

13 statements  

« prev     ^ index     » next       coverage.py v6.4.4, created at 2023-07-17 14:22 -0600

1from __future__ import annotations 

2 

3from functools import reduce 

4 

5import numpy as np 

6 

7from pandas._config import get_option 

8 

9 

10def ensure_decoded(s) -> str: 

11 """ 

12 If we have bytes, decode them to unicode. 

13 """ 

14 if isinstance(s, (np.bytes_, bytes)): 

15 s = s.decode(get_option("display.encoding")) 

16 return s 

17 

18 

19def result_type_many(*arrays_and_dtypes): 

20 """ 

21 Wrapper around numpy.result_type which overcomes the NPY_MAXARGS (32) 

22 argument limit. 

23 """ 

24 try: 

25 return np.result_type(*arrays_and_dtypes) 

26 except ValueError: 

27 # we have > NPY_MAXARGS terms in our expression 

28 return reduce(np.result_type, arrays_and_dtypes)