Add statistical libraries and update system prompt
Browse files- Add statsmodels and scikit-learn to requirements.txt for trend analysis
- Update system prompt with available libraries list
- Guide LLM to use appropriate libraries for statistical analysis
- Suggest simpler alternatives (numpy.polyfit) when possible
This resolves 'No module named statsmodels' errors for trend analysis queries.
π€ Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
- requirements.txt +3 -1
- src.py +10 -0
requirements.txt
CHANGED
|
@@ -10,4 +10,6 @@ langchain_google_genai
|
|
| 10 |
seaborn
|
| 11 |
matplotlib
|
| 12 |
pandas
|
| 13 |
-
numpy
|
|
|
|
|
|
|
|
|
| 10 |
seaborn
|
| 11 |
matplotlib
|
| 12 |
pandas
|
| 13 |
+
numpy
|
| 14 |
+
statsmodels
|
| 15 |
+
scikit-learn
|
src.py
CHANGED
|
@@ -289,6 +289,16 @@ df["Timestamp"] = pd.to_datetime(df["Timestamp"])
|
|
| 289 |
|
| 290 |
IMPORTANT: Only generate Python code - no explanations, no thinking, just clean code.
|
| 291 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 292 |
WHEN TO USE DIFFERENT OUTPUT TYPES:
|
| 293 |
- Simple questions asking "Which city", "What month" (1-2 values) β TEXT ANSWERS (store text in 'answer')
|
| 294 |
- Questions asking "Plot", "Show chart", "Visualize" β PLOTS (store filename in 'answer')
|
|
|
|
| 289 |
|
| 290 |
IMPORTANT: Only generate Python code - no explanations, no thinking, just clean code.
|
| 291 |
|
| 292 |
+
AVAILABLE LIBRARIES:
|
| 293 |
+
You can use these pre-installed libraries:
|
| 294 |
+
- pandas, numpy (data manipulation)
|
| 295 |
+
- matplotlib, seaborn, plotly (visualization)
|
| 296 |
+
- statsmodels (statistical modeling, trend analysis)
|
| 297 |
+
- scikit-learn (machine learning, regression)
|
| 298 |
+
- geopandas (geospatial analysis)
|
| 299 |
+
Use appropriate libraries for trend analysis, regression, statistical tests, etc.
|
| 300 |
+
For simple trends, prefer numpy.polyfit() over complex statistical libraries when possible.
|
| 301 |
+
|
| 302 |
WHEN TO USE DIFFERENT OUTPUT TYPES:
|
| 303 |
- Simple questions asking "Which city", "What month" (1-2 values) β TEXT ANSWERS (store text in 'answer')
|
| 304 |
- Questions asking "Plot", "Show chart", "Visualize" β PLOTS (store filename in 'answer')
|