Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1from functools import reduce 

2 

3import numpy as np 

4 

5from pandas._config import get_option 

6 

7 

8def _ensure_decoded(s): 

9 """ 

10 If we have bytes, decode them to unicode. 

11 """ 

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

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

14 return s 

15 

16 

17def result_type_many(*arrays_and_dtypes): 

18 """ 

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

20 argument limit. 

21 """ 

22 try: 

23 return np.result_type(*arrays_and_dtypes) 

24 except ValueError: 

25 # we have > NPY_MAXARGS terms in our expression 

26 return reduce(np.result_type, arrays_and_dtypes) 

27 

28 

29class NameResolutionError(NameError): 

30 pass