def index(self): """Get the index of the day of the week. Returns ------- IntegerValue The index of the day of the week. Ibis follows pandas conventions, where **Monday = 0 and Sunday = 6**. """ import ibis.expr.operations as ops return ops.DayOfWeekIndex(self.op().arg).to_expr()
def index(self): """Get the index of the day of the week. Returns ------- IntegerValue The index of the day of the week. !!! note "Ibis follows pandas' conventions for day numbers: Monday = 0 and Sunday = 6." """ # noqa: E501 import ibis.expr.operations as ops return ops.DayOfWeekIndex(self.op().arg).to_expr()
def extract_field_formatter(translator, expr, sql_attr=sql_attr): op = expr.op() week_names = [ 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday', ] expr_new = ops.DayOfWeekIndex(op.args[0]).to_expr() expr_new = expr_new.case() for i in range(7): expr_new = expr_new.when(i, week_names[i]) expr_new = expr_new.else_('').end() return translator.translate(expr_new)
def index(self): import ibis.expr.operations as ops return ops.DayOfWeekIndex(self.op().arg).to_expr()