# -*- coding: utf-8 -*-
"""
Created on Mon May 15 11:46:33 2023

@author: stan
"""

import pandas as pd
import matplotlib.pyplot as plt
import numpy as np

data = pd.read_excel(r'D:\Proekt Elena\return_farm.xlsx') 

df = pd.DataFrame(data)
#print(df)
array = df.values
return_farm = array[:,1]
year=array[:,0]

xpoints = year
ypoints = return_farm

plt.plot(xpoints, ypoints)
#plt.show()
#plt.boxplot(return_farm)
 
# show plot
plt.show()
#print(year)
mean_return = np.mean(return_farm)
std_return = np.std(return_farm)
print("Average Return: "+"{:.2%}".format(mean_return));
print("Standart Deviontion : "+"{:.2%}".format(std_return));
#print(x)
#print (return_farm * 100)
df2 = pd.DataFrame({"col2": [round(mean_return,2)*100]})
#print (df2)
bad_botton = [-20]
bad_range = ([23])
#well_botton = np.array([0])
well_range = [17]
#excelent_botton = np.array([11])
excelent_range = [10]
df = pd.DataFrame({'bad_botton' : bad_botton, 'well_range': well_range, 
                   'excelent_range' : excelent_range  })
ax = df.plot.bar(stacked=True)
#ax2 = ax.twinx()
ax.plot(ax.get_xticks(),
   #df[['col1', 'col2']].values,
   df2[['col2']].values,
   linestyle='-',
     marker='o', linewidth=2.0)

plt.show()