def get_chart(self, records, garden): df = pd.DataFrame.from_records(records.values('recipes_count', 'recorded'), coerce_float=True) qdf = df.groupby('recorded').sum()['recipes_count'] return horizontal_bar(qdf, make_chart_name('recipes', garden), xlabel='TOTAL RECIPES')
def get_chart(self, records, garden): df = pd.DataFrame.from_records(records.values('crop__name', 'quantity', 'recorded'), coerce_float=True) qdf = df.groupby('crop__name').sum()['quantity'] return horizontal_bar(qdf, make_chart_name('cropcount', garden))
def get_chart(self, records, garden): df = pd.DataFrame.from_records(records.values('crop__name', 'weight', 'recorded'), coerce_float=True) qdf = df.groupby('crop__name').sum()['weight'] qdf = qdf.apply(lambda x: to_preferred_weight_units(x, garden, force_large_units=True).magnitude) units = preferred_weight_units(garden, large=True) return horizontal_bar(qdf, make_chart_name('harvestcount', garden), xlabel=('%s harvested' % units).upper())
def get_chart(self, records, garden): df = pd.DataFrame.from_records(records.values('crop__name', 'weight', 'recorded'), coerce_float=True) qdf = df.groupby('crop__name').sum()['weight'] qdf = qdf.apply(lambda x: to_preferred_weight_units( x, garden, force_large_units=True).magnitude) units = preferred_weight_units(garden, large=True) return horizontal_bar(qdf, make_chart_name('harvestcount', garden), xlabel=('%s harvested' % units).upper())
def get_chart(self, records, garden): df = pd.DataFrame.from_records(records.values('total_price', 'recorded'), coerce_float=True) qdf = df.groupby('recorded').sum()['total_price'] return horizontal_bar(qdf, make_chart_name('sales', garden))