示例#1
0
static nd::array function_ndo_strftime(const nd::array& n, const std::string& format) {
    // TODO: Allow 'format' itself to be an array, with broadcasting, etc.
    if (format.empty()) {
        throw runtime_error("format string for strftime should not be empty");
    }
    return n.replace_dtype(ndt::make_unary_expr(ndt::make_string(), n.get_dtype(),
                    make_strftime_kernelgen(format)));
}
示例#2
0
static nd::array function_ndo_replace(const nd::array& n, int32_t year, int32_t month, int32_t day) {
    // TODO: Allow 'year', 'month', and 'day' to be arrays, with broadcasting, etc.
    if (year == numeric_limits<int32_t>::max() && month == numeric_limits<int32_t>::max() &&
            day == numeric_limits<int32_t>::max()) {
        throw std::runtime_error("no parameters provided to date.replace, should provide at least one");
    }
    return n.replace_dtype(ndt::make_unary_expr(ndt::make_date(), n.get_dtype(),
                           make_replace_kernelgen(year, month, day)));
}
示例#3
0
static nd::array function_ndo_to_struct(const nd::array& n) {
    return n.replace_dtype(ndt::make_property(n.get_dtype(), "struct"));
}
示例#4
0
static nd::array property_ndo_get_microsecond(const nd::array& n) {
    return n.replace_dtype(ndt::make_property(n.get_dtype(), "microsecond"));
}
示例#5
0
static nd::array property_ndo_get_hour(const nd::array& n) {
    return n.replace_dtype(ndt::make_property(n.get_dtype(), "hour"));
}
示例#6
0
static nd::array function_ndo_weekday(const nd::array& n) {
    return n.replace_dtype(ndt::make_property(n.get_dtype(), "weekday"));
}
示例#7
0
static nd::array property_ndo_get_tick(const nd::array &n)
{
  return n.replace_dtype(ndt::property_type::make(n.get_dtype(), "tick"));
}
static nd::array property_complex_conj(const nd::array& n) {
    return n.replace_dtype(ndt::make_property(n.get_dtype(), "conj"));
}