Python pandas.core.dtypes.common.is_dtype_equal() Examples
The following are 15
code examples of pandas.core.dtypes.common.is_dtype_equal().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
pandas.core.dtypes.common
, or try the search function
.
Example #1
Source File: test_common.py From vnpy_crypto with MIT License | 6 votes |
def test_dtype_equal_strict(): # we are strict on kind equality for dtype in [np.int8, np.int16, np.int32]: assert not com.is_dtype_equal(np.int64, dtype) for dtype in [np.float32]: assert not com.is_dtype_equal(np.float64, dtype) # strict w.r.t. PeriodDtype assert not com.is_dtype_equal(PeriodDtype('D'), PeriodDtype('2D')) # strict w.r.t. datetime64 assert not com.is_dtype_equal( com.pandas_dtype('datetime64[ns, US/Eastern]'), com.pandas_dtype('datetime64[ns, CET]')) # see gh-15941: no exception should be raised assert not com.is_dtype_equal(None, None)
Example #2
Source File: test_common.py From elasticintel with GNU General Public License v3.0 | 6 votes |
def test_dtype_equal_strict(): # we are strict on kind equality for dtype in [np.int8, np.int16, np.int32]: assert not com.is_dtype_equal(np.int64, dtype) for dtype in [np.float32]: assert not com.is_dtype_equal(np.float64, dtype) # strict w.r.t. PeriodDtype assert not com.is_dtype_equal(PeriodDtype('D'), PeriodDtype('2D')) # strict w.r.t. datetime64 assert not com.is_dtype_equal( com.pandas_dtype('datetime64[ns, US/Eastern]'), com.pandas_dtype('datetime64[ns, CET]')) # see gh-15941: no exception should be raised assert not com.is_dtype_equal(None, None)
Example #3
Source File: test_common.py From twitter-stock-recommendation with MIT License | 6 votes |
def test_dtype_equal_strict(): # we are strict on kind equality for dtype in [np.int8, np.int16, np.int32]: assert not com.is_dtype_equal(np.int64, dtype) for dtype in [np.float32]: assert not com.is_dtype_equal(np.float64, dtype) # strict w.r.t. PeriodDtype assert not com.is_dtype_equal(PeriodDtype('D'), PeriodDtype('2D')) # strict w.r.t. datetime64 assert not com.is_dtype_equal( com.pandas_dtype('datetime64[ns, US/Eastern]'), com.pandas_dtype('datetime64[ns, CET]')) # see gh-15941: no exception should be raised assert not com.is_dtype_equal(None, None)
Example #4
Source File: test_infer_dtype.py From recruit with Apache License 2.0 | 5 votes |
def test_infer_dtype_from_array(arr, expected, pandas_dtype): dtype, _ = infer_dtype_from_array(arr, pandas_dtype=pandas_dtype) assert is_dtype_equal(dtype, expected)
Example #5
Source File: test_common.py From recruit with Apache License 2.0 | 5 votes |
def test_dtype_equal(name1, dtype1, name2, dtype2): # match equal to self, but not equal to other assert com.is_dtype_equal(dtype1, dtype1) if name1 != name2: assert not com.is_dtype_equal(dtype1, dtype2)
Example #6
Source File: test_common.py From recruit with Apache License 2.0 | 5 votes |
def test_dtype_equal_strict(dtype1, dtype2): assert not com.is_dtype_equal(dtype1, dtype2)
Example #7
Source File: dtypes.py From recruit with Apache License 2.0 | 5 votes |
def __eq__(self, other): if isinstance(other, compat.string_types): return other.lower() in (self.name.lower(), str(self).lower()) elif not isinstance(other, IntervalDtype): return False elif self.subtype is None or other.subtype is None: # None should match any subtype return True else: from pandas.core.dtypes.common import is_dtype_equal return is_dtype_equal(self.subtype, other.subtype)
Example #8
Source File: test_common.py From vnpy_crypto with MIT License | 5 votes |
def test_dtype_equal(name1, dtype1, name2, dtype2): # match equal to self, but not equal to other assert com.is_dtype_equal(dtype1, dtype1) if name1 != name2: assert not com.is_dtype_equal(dtype1, dtype2)
Example #9
Source File: dtypes.py From vnpy_crypto with MIT License | 5 votes |
def __eq__(self, other): if isinstance(other, compat.string_types): return other.lower() in (self.name.lower(), str(self).lower()) elif not isinstance(other, IntervalDtype): return False elif self.subtype is None or other.subtype is None: # None should match any subtype return True else: from pandas.core.dtypes.common import is_dtype_equal return is_dtype_equal(self.subtype, other.subtype)
Example #10
Source File: test_infer_dtype.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 5 votes |
def test_infer_dtype_from_array(arr, expected, pandas_dtype): dtype, _ = infer_dtype_from_array(arr, pandas_dtype=pandas_dtype) assert is_dtype_equal(dtype, expected)
Example #11
Source File: test_common.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 5 votes |
def test_dtype_equal(name1, dtype1, name2, dtype2): # match equal to self, but not equal to other assert com.is_dtype_equal(dtype1, dtype1) if name1 != name2: assert not com.is_dtype_equal(dtype1, dtype2)
Example #12
Source File: test_common.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 5 votes |
def test_dtype_equal_strict(dtype1, dtype2): assert not com.is_dtype_equal(dtype1, dtype2)
Example #13
Source File: dtypes.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 5 votes |
def __eq__(self, other): if isinstance(other, compat.string_types): return other.lower() in (self.name.lower(), str(self).lower()) elif not isinstance(other, IntervalDtype): return False elif self.subtype is None or other.subtype is None: # None should match any subtype return True else: from pandas.core.dtypes.common import is_dtype_equal return is_dtype_equal(self.subtype, other.subtype)
Example #14
Source File: test_common.py From elasticintel with GNU General Public License v3.0 | 5 votes |
def test_dtype_equal(name1, dtype1, name2, dtype2): # match equal to self, but not equal to other assert com.is_dtype_equal(dtype1, dtype1) if name1 != name2: assert not com.is_dtype_equal(dtype1, dtype2)
Example #15
Source File: test_common.py From twitter-stock-recommendation with MIT License | 5 votes |
def test_dtype_equal(name1, dtype1, name2, dtype2): # match equal to self, but not equal to other assert com.is_dtype_equal(dtype1, dtype1) if name1 != name2: assert not com.is_dtype_equal(dtype1, dtype2)