Exemplo n.º 1
0
    def fillna(self, fill_value):
        if cudf.utils.utils.isnat(fill_value):
            return _fillna_natwise(self)
        if is_scalar(fill_value):
            if not isinstance(fill_value, cudf.Scalar):
                fill_value = cudf.Scalar(fill_value, dtype=self.dtype)
        else:
            fill_value = column.as_column(fill_value, nan_as_null=False)

        result = libcudf.replace.replace_nulls(self, fill_value)
        return result
Exemplo n.º 2
0
    def fillna(self, fill_value=None, method=None):
        if fill_value is not None:
            if cudf.utils.utils.isnat(fill_value):
                return _fillna_natwise(self)
            if is_scalar(fill_value):
                if not isinstance(fill_value, cudf.Scalar):
                    fill_value = cudf.Scalar(fill_value, dtype=self.dtype)
            else:
                fill_value = column.as_column(fill_value, nan_as_null=False)

        return super().fillna(fill_value, method)
Exemplo n.º 3
0
    def fillna(self, fill_value):
        if cudf.utils.utils.isnat(fill_value):
            return _fillna_natwise(self)
        col = self
        if is_scalar(fill_value):
            if isinstance(fill_value, np.timedelta64):
                dtype = determine_out_dtype(self.dtype, fill_value.dtype)
                fill_value = fill_value.astype(dtype)
                col = col.astype(dtype)
            if not isinstance(fill_value, cudf.Scalar):
                fill_value = cudf.Scalar(fill_value, dtype=dtype)
        else:
            fill_value = column.as_column(fill_value, nan_as_null=False)

        result = libcudf.replace.replace_nulls(col, fill_value)
        return result
Exemplo n.º 4
0
    def fillna(self, fill_value=None, method=None):
        if fill_value is not None:
            if cudf.utils.utils.isnat(fill_value):
                return _fillna_natwise(self)
            col = self
            if is_scalar(fill_value):
                if isinstance(fill_value, np.timedelta64):
                    dtype = determine_out_dtype(self.dtype, fill_value.dtype)
                    fill_value = fill_value.astype(dtype)
                    col = col.astype(dtype)
                if not isinstance(fill_value, cudf.Scalar):
                    fill_value = cudf.Scalar(fill_value, dtype=dtype)
            else:
                fill_value = column.as_column(fill_value, nan_as_null=False)

            return ColumnBase.fillna(col, fill_value)
        else:
            return super().fillna(method=method)