Python pandas.core.common._any_none() Examples

The following are 17 code examples of pandas.core.common._any_none(). 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.common , or try the search function .
Example #1
Source File: test_common.py    From predictive-maintenance-using-machine-learning with Apache License 2.0 5 votes vote down vote up
def test_any_none():
    assert (com._any_none(1, 2, 3, None))
    assert (not com._any_none(1, 2, 3, 4)) 
Example #2
Source File: test_interval.py    From twitter-stock-recommendation with MIT License 5 votes vote down vote up
def test_constructor_errors_tz(self, tz_left, tz_right):
        # GH 18538
        left = Timestamp('2017-01-01', tz=tz_left)
        right = Timestamp('2017-01-02', tz=tz_right)
        error = TypeError if com._any_none(tz_left, tz_right) else ValueError
        with pytest.raises(error):
            Interval(left, right) 
Example #3
Source File: test_common.py    From twitter-stock-recommendation with MIT License 5 votes vote down vote up
def test_any_none():
    assert (com._any_none(1, 2, 3, None))
    assert (not com._any_none(1, 2, 3, 4)) 
Example #4
Source File: interval.py    From elasticintel with GNU General Public License v3.0 5 votes vote down vote up
def _is_type_compatible(a, b):
    """helper for interval_range to check type compat of start/end/freq"""
    is_ts_compat = lambda x: isinstance(x, (Timestamp, DateOffset))
    is_td_compat = lambda x: isinstance(x, (Timedelta, DateOffset))
    return ((is_number(a) and is_number(b)) or
            (is_ts_compat(a) and is_ts_compat(b)) or
            (is_td_compat(a) and is_td_compat(b)) or
            com._any_none(a, b)) 
Example #5
Source File: test_common.py    From elasticintel with GNU General Public License v3.0 5 votes vote down vote up
def test_any_none():
    assert (com._any_none(1, 2, 3, None))
    assert (not com._any_none(1, 2, 3, 4)) 
Example #6
Source File: interval.py    From Splunking-Crime with GNU Affero General Public License v3.0 5 votes vote down vote up
def _is_type_compatible(a, b):
    """helper for interval_range to check type compat of start/end/freq"""
    is_ts_compat = lambda x: isinstance(x, (Timestamp, DateOffset))
    is_td_compat = lambda x: isinstance(x, (Timedelta, DateOffset))
    return ((is_number(a) and is_number(b)) or
            (is_ts_compat(a) and is_ts_compat(b)) or
            (is_td_compat(a) and is_td_compat(b)) or
            com._any_none(a, b)) 
Example #7
Source File: series.py    From predictive-maintenance-using-machine-learning with Apache License 2.0 5 votes vote down vote up
def _get_values_tuple(self, key):
        # mpl hackaround
        if com._any_none(*key):
            return self._get_values(key)

        if not isinstance(self.index, MultiIndex):
            raise ValueError('Can only tuple-index with a MultiIndex')

        # If key is contained, would have returned by now
        indexer, new_index = self.index.get_loc_level(key)
        return self._constructor(self._values[indexer],
                                 index=new_index).__finalize__(self) 
Example #8
Source File: interval.py    From predictive-maintenance-using-machine-learning with Apache License 2.0 5 votes vote down vote up
def _is_type_compatible(a, b):
    """helper for interval_range to check type compat of start/end/freq"""
    is_ts_compat = lambda x: isinstance(x, (Timestamp, DateOffset))
    is_td_compat = lambda x: isinstance(x, (Timedelta, DateOffset))
    return ((is_number(a) and is_number(b)) or
            (is_ts_compat(a) and is_ts_compat(b)) or
            (is_td_compat(a) and is_td_compat(b)) or
            com._any_none(a, b)) 
Example #9
Source File: test_interval.py    From predictive-maintenance-using-machine-learning with Apache License 2.0 5 votes vote down vote up
def test_constructor_errors_tz(self, tz_left, tz_right):
        # GH 18538
        left = Timestamp('2017-01-01', tz=tz_left)
        right = Timestamp('2017-01-02', tz=tz_right)
        error = TypeError if com._any_none(tz_left, tz_right) else ValueError
        with pytest.raises(error):
            Interval(left, right) 
Example #10
Source File: test_common.py    From recruit with Apache License 2.0 5 votes vote down vote up
def test_any_none():
    assert (com._any_none(1, 2, 3, None))
    assert (not com._any_none(1, 2, 3, 4)) 
Example #11
Source File: series.py    From vnpy_crypto with MIT License 5 votes vote down vote up
def _get_values_tuple(self, key):
        # mpl hackaround
        if com._any_none(*key):
            return self._get_values(key)

        if not isinstance(self.index, MultiIndex):
            raise ValueError('Can only tuple-index with a MultiIndex')

        # If key is contained, would have returned by now
        indexer, new_index = self.index.get_loc_level(key)
        return self._constructor(self._values[indexer],
                                 index=new_index).__finalize__(self) 
Example #12
Source File: interval.py    From vnpy_crypto with MIT License 5 votes vote down vote up
def _is_type_compatible(a, b):
    """helper for interval_range to check type compat of start/end/freq"""
    is_ts_compat = lambda x: isinstance(x, (Timestamp, DateOffset))
    is_td_compat = lambda x: isinstance(x, (Timedelta, DateOffset))
    return ((is_number(a) and is_number(b)) or
            (is_ts_compat(a) and is_ts_compat(b)) or
            (is_td_compat(a) and is_td_compat(b)) or
            com._any_none(a, b)) 
Example #13
Source File: test_interval.py    From vnpy_crypto with MIT License 5 votes vote down vote up
def test_constructor_errors_tz(self, tz_left, tz_right):
        # GH 18538
        left = Timestamp('2017-01-01', tz=tz_left)
        right = Timestamp('2017-01-02', tz=tz_right)
        error = TypeError if com._any_none(tz_left, tz_right) else ValueError
        with pytest.raises(error):
            Interval(left, right) 
Example #14
Source File: test_common.py    From vnpy_crypto with MIT License 5 votes vote down vote up
def test_any_none():
    assert (com._any_none(1, 2, 3, None))
    assert (not com._any_none(1, 2, 3, 4)) 
Example #15
Source File: series.py    From recruit with Apache License 2.0 5 votes vote down vote up
def _get_values_tuple(self, key):
        # mpl hackaround
        if com._any_none(*key):
            return self._get_values(key)

        if not isinstance(self.index, MultiIndex):
            raise ValueError('Can only tuple-index with a MultiIndex')

        # If key is contained, would have returned by now
        indexer, new_index = self.index.get_loc_level(key)
        return self._constructor(self._values[indexer],
                                 index=new_index).__finalize__(self) 
Example #16
Source File: interval.py    From recruit with Apache License 2.0 5 votes vote down vote up
def _is_type_compatible(a, b):
    """helper for interval_range to check type compat of start/end/freq"""
    is_ts_compat = lambda x: isinstance(x, (Timestamp, DateOffset))
    is_td_compat = lambda x: isinstance(x, (Timedelta, DateOffset))
    return ((is_number(a) and is_number(b)) or
            (is_ts_compat(a) and is_ts_compat(b)) or
            (is_td_compat(a) and is_td_compat(b)) or
            com._any_none(a, b)) 
Example #17
Source File: test_interval.py    From recruit with Apache License 2.0 5 votes vote down vote up
def test_constructor_errors_tz(self, tz_left, tz_right):
        # GH 18538
        left = Timestamp('2017-01-01', tz=tz_left)
        right = Timestamp('2017-01-02', tz=tz_right)
        error = TypeError if com._any_none(tz_left, tz_right) else ValueError
        with pytest.raises(error):
            Interval(left, right)