# -*- coding: utf-8 -*-
"""
Created on Thu Jul 27 18:07:10 2023

@author: stani
"""

#from matplotlib import pyplot as plt
#import pandas as pd
#import streamlit as st
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn import datasets
import warnings
warnings.filterwarnings("ignore")
import datetime
from datetime import date
import seaborn as sns
import calendar
import matplotlib.dates as mdates


data = pd.read_excel(r'C:\Users\stani\Desktop\Webapp\st_zagora\data_for_python2.xlsx') 
df1 = pd.DataFrame(data)
#profit = round(df1.groupby(df1.data.dt.year)['profit_month'].sum())
#milk_production = round(df1.groupby(df1.data.dt.year)['litters'].sum(),2)
profit = df1['profit_month'].sum()
milk_production = df1['litters'].sum()
profit_per_litter= round(profit/milk_production,2)
print(profit_per_litter)
#df2 = pd.DataFrame({"col2": [0.19]})
#df2 = pd.DataFrame({"col2": profit_per_litter.values})
bad_botton = [-0.23]
bad_range = ([0.23])
#well_botton = np.array([0])
well_range = [0.11]
#excelent_botton = np.array([11])
excelent_range = [0.16]
index =['Печалба/литър']
df = pd.DataFrame({'bad_botton' : bad_botton,
                  'well_range': well_range,  'excelent_range' : excelent_range  }, index=index)
print(df)
ax = df.plot.bar(stacked=True)
#ax2 = ax.twinx()
ax.plot(ax.get_xticks(),profit_per_litter, linestyle='-', marker='o', linewidth=3.0)

plt.show()