VEDAGI1 commited on
Commit
3ce7830
·
verified ·
1 Parent(s): 72ba172

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -0
app.py CHANGED
@@ -729,6 +729,7 @@ CRITICAL RULES:
729
  12. **SCALAR VS VECTORIZED:** When applying a cleaning function to DataFrame columns, use `.apply()` for element-wise operations: `df['col'].apply(clean_func)`. Do NOT pass a Series to a function expecting a single value. For a single extracted value, use `.iloc[0]` to get the scalar before processing.
730
  13. **COLUMN AVAILABILITY AFTER MERGE:** After merging DataFrames, only columns explicitly included in the merge will be available. If you need 'city' later, include it in the initial selection: `df[['facility_name', 'city', 'latitude']]`. Before accessing any column, verify it exists in the DataFrame or was included in the merge.
731
  14. **BROADCASTING SCALAR TO ALL ROWS:** To add a single value to all rows in a DataFrame, do NOT use merge. Instead, extract the scalar first, then assign directly: `value = other_df.loc[condition, 'col'].iloc[0]; df['new_col'] = value`. This broadcasts the scalar to all rows.
 
732
 
733
  --- USER'S SCENARIO ---
734
  {user_scenario}
 
729
  12. **SCALAR VS VECTORIZED:** When applying a cleaning function to DataFrame columns, use `.apply()` for element-wise operations: `df['col'].apply(clean_func)`. Do NOT pass a Series to a function expecting a single value. For a single extracted value, use `.iloc[0]` to get the scalar before processing.
730
  13. **COLUMN AVAILABILITY AFTER MERGE:** After merging DataFrames, only columns explicitly included in the merge will be available. If you need 'city' later, include it in the initial selection: `df[['facility_name', 'city', 'latitude']]`. Before accessing any column, verify it exists in the DataFrame or was included in the merge.
731
  14. **BROADCASTING SCALAR TO ALL ROWS:** To add a single value to all rows in a DataFrame, do NOT use merge. Instead, extract the scalar first, then assign directly: `value = other_df.loc[condition, 'col'].iloc[0]; df['new_col'] = value`. This broadcasts the scalar to all rows.
732
+ 15. **EXTRACT OPERATIONAL PARAMETERS FROM DATA:** For capacity, rates, or throughput values, ALWAYS extract them directly from the data rather than assuming values. Print/log the extracted value to verify it matches expectations. For ranges like "8–10", use the LOWER bound for conservative estimates in capacity planning, not the midpoint or upper bound.
733
 
734
  --- USER'S SCENARIO ---
735
  {user_scenario}