Rhino patrol effort vs poaching incidents
Scenario
You are a data scientist. A reserve records monthly ranger patrol hours and poaching incidents. Management wants to know whether more patrol hours actually reduce incidents.
Question
Teach a straight-line model using patrol hours, then show the line's direction and how well it fits.
Your task
- Put patrol_hours into X using double brackets
- Put incidents into y
- Teach LinearRegression with fit, then print coef_ and score
Intermediate · Data Filtering & Record Counting — question 1 of 30
1. Choose your dataset
Pick an industry and a size. Your code and results change to match.
Rhino patrol effort vs poaching incidents
Teach a straight-line model using patrol hours, then show the line's direction and how well it fits.
Your code cell is below. Press Check my answer to run the cell — the result appears as Out [1].
💡 Explain my whole code, line by line (hover any word in the editor for a tip)
🌈 In short — no coding words
Altogether: this script runs top to bottom, one line at a time, building up the answer step by step.
Dataset & schema
patrol_log
The tiny starter data. Bigger data scrolls.
Fields
| month | patrol_hours | incidents |
|---|---|---|
| 2026-01 | 420 | 7 |
| 2026-02 | 610 | 4 |
| 2026-03 | 380 | 9 |
| 2026-04 | 720 | 2 |
$ Press “Check my answer” — results appear here.Your next steps
Each item turns green when your answer includes it.
- Uses LinearRegression
- 2D feature matrix
- Fits the model
- Reports the slope
- Reports R²