/pandas/computation/common.py
Python | 24 lines | 14 code | 6 blank | 4 comment | 3 complexity | ba3da092b6f524349ebd066ba3b6f67b MD5 | raw file
Possible License(s): BSD-3-Clause, Apache-2.0
- import numpy as np
- import pandas as pd
- from pandas.compat import reduce
- def _ensure_decoded(s):
- """ if we have bytes, decode them to unicode """
- if isinstance(s, (np.bytes_, bytes)):
- s = s.decode(pd.get_option('display.encoding'))
- return s
- def _result_type_many(*arrays_and_dtypes):
- """ wrapper around numpy.result_type which overcomes the NPY_MAXARGS (32)
- argument limit """
- try:
- return np.result_type(*arrays_and_dtypes)
- except ValueError:
- # we have > NPY_MAXARGS terms in our expression
- return reduce(np.result_type, arrays_and_dtypes)
- class NameResolutionError(NameError):
- pass