Esmaeilkiani commited on
Commit
403ffc4
·
verified ·
1 Parent(s): 5d5947d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -7,10 +7,10 @@ from dash import dcc, html, Input, Output, State
7
  import dash_bootstrap_components as dbc
8
 
9
  # Load CSV into DataFrame
10
- df = pd.read_csv('dashboard18.csv')
11
 
12
  # List of unique farm names for the dropdown
13
- farm_names = df['مزرعه'].unique()
14
 
15
  # Initialize the Dash app
16
  app = dash.Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP])
@@ -44,11 +44,11 @@ def update_graph(selected_farm):
44
  return go.Figure(), "Please select a farm."
45
 
46
  # Filter data based on selected farm
47
- filtered_df = df[df['Farm Name'] == selected_farm]
48
 
49
  # Prepare 3D surface data
50
  weeks = np.arange(1, 19)
51
- heights = filtered_df.iloc[:, 1:19].values # Adjust for your actual data structure
52
 
53
  fig = make_subplots(rows=1, cols=1, specs=[[{'type': 'surface'}]])
54
 
@@ -56,7 +56,7 @@ def update_graph(selected_farm):
56
  go.Surface(
57
  z=heights,
58
  x=weeks,
59
- y=filtered_df['Farm Name'].values,
60
  colorscale='Viridis'
61
  )
62
  )
 
7
  import dash_bootstrap_components as dbc
8
 
9
  # Load CSV into DataFrame
10
+ df = pd.read_csv('/mnt/data/dashboard18.csv')
11
 
12
  # List of unique farm names for the dropdown
13
+ farm_names = df[' مزرعه '].unique()
14
 
15
  # Initialize the Dash app
16
  app = dash.Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP])
 
44
  return go.Figure(), "Please select a farm."
45
 
46
  # Filter data based on selected farm
47
+ filtered_df = df[df[' مزرعه '] == selected_farm]
48
 
49
  # Prepare 3D surface data
50
  weeks = np.arange(1, 19)
51
+ heights = filtered_df.iloc[:, 6:24].values # Adjusted to match height columns
52
 
53
  fig = make_subplots(rows=1, cols=1, specs=[[{'type': 'surface'}]])
54
 
 
56
  go.Surface(
57
  z=heights,
58
  x=weeks,
59
+ y=filtered_df[' مزرعه '].values,
60
  colorscale='Viridis'
61
  )
62
  )