#! /usr/bin/env python # -*- coding: UTF-8 -*- import matplotlib.pyplot as plt from statistikkHelpers import * import matplotlib.dates as mdates def getInputType(): inp = 0 while not (inp == '1' or inp == '2' or inp == '3' or inp == '4'): print('type 1 for user-statistics') print('type 2 for product-statistics') print('type 3 for global-statistics') print('type 4 to enter loop-mode') inp = input('') return int(inp) def getDateFile(date, n): try: if n==0: inp = input('start date? (yyyy-mm-dd) ') elif n==-1: inp = input('end date? (yyyy-mm-dd) ') year = inp.partition('-') month = year[2].partition('-') return datetime.date(int(year[0]), int(month[0]), int(month[2])) except: print('invalid date, setting start start date') if n==0: print('to date found on first line') elif n==-1: print('to date found on last line') print(date) return datetime.date(int(date.partition('-')[0]), int(date.partition('-')[2].partition('-')[0]), int(date.partition('-')[2].partition('-')[2])) def dateToDateNumFile(date, startDate): year = date.partition('-') month = year[2].partition('-') day = datetime.date(int(year[0]), int(month[0]), int(month[2])) deltaDays = day-startDate return int(deltaDays.days), day.weekday() def getProducts(products): product = [] products = products.partition('¤') product.append(products[0]) while (products[1]=='¤'): products = products[2].partition('¤') product.append(products[0]) return product def piePlot(dictionary, n): keys = [] values = [] i=0 for key in sorted(dictionary, key=dictionary.get, reverse=True): values.append(dictionary[key]) if i