|
@@ -13,6 +13,7 @@ import os
|
|
|
import sys
|
|
|
from sqlite3 import Cursor
|
|
|
import psycopg
|
|
|
+import numpy as np
|
|
|
from db_credentials import HOST, PASSWORD
|
|
|
ALL_UNITS = {'g','kg','mL','L','Pieces','Bunches','Bags'}
|
|
|
host = f'host={HOST}'
|
|
@@ -79,6 +80,10 @@ print(d)
|
|
|
sns.set_theme()
|
|
|
now = datetime.now().date()
|
|
|
d['ts_month'] = d['ts_raw'].apply(lambda x: date(x.date().year, x.date().month,1))
|
|
|
+d[['price','quantity']] = d[['price','quantity']].apply(
|
|
|
+ lambda y,axis=None: y.apply(lambda x: x and float(x)), #if y.name in ('price','quantity')
|
|
|
+ axis=0
|
|
|
+)
|
|
|
p = d[d['ts_month'] == date(now.year,now.month,1) ].groupby(['ts_month','group',])['price', 'quantity'].sum()
|
|
|
|
|
|
if not p.empty:
|