Exemplo n.º 1
0
    def f(self):
        values = self.asi8
        result = get_timedelta_field(values, alias)
        if self.hasnans:
            result = self._maybe_mask_results(result, convert='float64')

        return result
Exemplo n.º 2
0
    def f(self):
        values = self.asi8
        result = get_timedelta_field(values, alias)
        if self.hasnans:
            result = self._maybe_mask_results(result, convert='float64')

        return result
Exemplo n.º 3
0
    def f(self):
        values = self.asi8
        result = get_timedelta_field(values, alias)
        if self._hasnans:
            result = self._maybe_mask_results(result,
                                              fill_value=None,
                                              convert="float64")

        return result
Exemplo n.º 4
0
    def f(self) -> np.ndarray:
        values = self.asi8
        result = get_timedelta_field(values, alias, reso=self._reso)
        if self._hasna:
            result = self._maybe_mask_results(
                result, fill_value=None, convert="float64"
            )

        return result
Exemplo n.º 5
0
def test_fields_readonly():
    # https://github.com/vaexio/vaex/issues/357
    #  fields functions shouldn't raise when we pass read-only data
    dtindex = np.arange(5, dtype=np.int64) * 10**9 * 3600 * 24 * 32
    dtindex.flags.writeable = False

    result = fields.get_date_name_field(dtindex, "month_name")
    expected = np.array(["January", "February", "March", "April", "May"],
                        dtype=object)
    tm.assert_numpy_array_equal(result, expected)

    result = fields.get_date_field(dtindex, "Y")
    expected = np.array([1970, 1970, 1970, 1970, 1970], dtype=np.int32)
    tm.assert_numpy_array_equal(result, expected)

    result = fields.get_start_end_field(dtindex, "is_month_start", None)
    expected = np.array([True, False, False, False, False], dtype=np.bool_)
    tm.assert_numpy_array_equal(result, expected)

    # treat dtindex as timedeltas for this next one
    result = fields.get_timedelta_field(dtindex, "days")
    expected = np.arange(5, dtype=np.int32) * 32
    tm.assert_numpy_array_equal(result, expected)
Exemplo n.º 6
0
def test_get_timedelta_field_readonly(dtindex):
    # treat dtindex as timedeltas for this next one
    result = fields.get_timedelta_field(dtindex, "days")
    expected = np.arange(5, dtype=np.int32) * 32
    tm.assert_numpy_array_equal(result, expected)
Exemplo n.º 7
0
 def time_get_timedelta_field(self, size, field):
     get_timedelta_field(self.i8data, field)