Пример #1
0
def shift_month_end(date):
    date = arrow.get(date)
    # shift to next month
    date = date.shift(months=1).format('YYYY-MM')
    date = arrow.get(date)
    # shift to month last day
    return date.shift(days=-1).format('YYYY-MM-DD')
Пример #2
0
def shift_month_periods_end(peroids, date):
    date = arrow.get(date)
    # cur month
    date = date.format('YYYY-MM')
    date = arrow.get(date)
    date = date.shift(months=peroids + 1)
    # shift to month last day
    return date.shift(days=-1).format('YYYY-MM-DD')
Пример #3
0
def shift_week_periods_end(peroids, date):
    date = arrow.get(date)
    # shift to next week
    r = pd.date_range(start=date.shift(weeks=peroids).format('YYYY-MM-DD'), periods=1, freq='W')
    # get date
    r = pd.to_datetime(r)
    date = arrow.get(r[0]).format('YYYY-MM-DD')
    return date
Пример #4
0
def shift_week_start(date):
    date = arrow.get(date)
    week_day = date.weekday()
    date = date.shift(days=-week_day)
    date = date.format('YYYY-MM-DD')
    return date
Пример #5
0
def shift_yesterday():
    date = arrow.now()
    date = date.shift(days=-1)
    return date.format('YYYY-MM-DD')
Пример #6
0
        for row in reader:
            date = arrow.get(row['Datum'], 'YYYY-MM-DD')
            description = row['Omschrijving']
            pay_time = description[len(btlatm):]
            pay_time = pay_time[:5]
            hour = pay_time[0:2]
            if hour[0] == '0':
                hour = hour[1:]

            hour = int(hour)
            stayed_in_amsterdam = hour <= 3 or hour >= 13

            if hour >= 0 and hour <= 3:
                # holy shit erwin wtf...
                # gotta correct for that
                date = date.shift(days=-1)
                print('Stop leaving work so late: ' + description)

            if (date < fromday) or (date > today): continue

            amsterdamParkingZeeburg.add_trip(date, float(row['Bedrag']) * -1.0)

            if stayed_in_amsterdam:
                daysInAmsterdam.append(date)

if args.pm_csv is not None:
    print('Processing parkmobile data')
    reader = csv.DictReader(args.pm_csv)

    for row in reader:
        # Mark all days in amsterdam when we parked there