Spaces:
Sleeping
Sleeping
File size: 1,797 Bytes
8242ea4 99dc75c 8242ea4 99dc75c 8242ea4 99dc75c 8242ea4 99dc75c 5918be4 8242ea4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
import streamlit as st
import pandas as pd
import plotly.graph_objs as go
# عنوان برنامه
st.set_page_config(page_title='اداره زراعت و کنترل محصول', layout='wide')
st.title('اداره زراعت و کنترل محصول')
# آپلود فایل
uploaded_file = st.file_uploader("لطفا فایل Excel خود را آپلود کنید", type=["xlsx", "xls"])
if uploaded_file is not None:
# خواندن دادهها از فایل اکسل
df = pd.read_excel(uploaded_file, sheet_name=0)
st.write("دادههای بارگذاری شده:")
st.dataframe(df)
# نمودار سه بعدی
st.subheader("نمودار سه بعدی رشد مزارع")
fig = go.Figure(data=[go.Scatter3d(
x=df['هفته'],
y=df['ارتفاع'],
z=df['رشد'],
mode='markers',
marker=dict(
size=8,
color=df['ارتفاع'], # set color to an array/list of desired values
colorscale='Viridis', # choose a colorscale
opacity=0.8
)
)])
fig.update_layout(scene=dict(
xaxis_title='هفته',
yaxis_title='ارتفاع',
zaxis_title='رشد'
))
st.plotly_chart(fig)
# تحلیل دادهها
st.subheader("گزارش تحلیلی")
average_height = df['ارتفاع'].mean()
average_growth = df['رشد'].mean()
# Load custom CSS
def load_css(file_path):
with open(file_path) as f:
st.markdown(f'<style>{f.read()}</style>', unsafe_allow_html=True)
load_css("styles.css")
st.markdown(f"* **میانگین ارتفاع:** {average_height:.2f} سانتیمتر")
st.markdown(f"* **میانگین رشد:** {average_growth:.2f} سانتیمتر")
|