Skip to content

Replace list+ndarray concatenation with numpy operations in tutorials#91

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/update-ndarray-in-tutorials
Draft

Replace list+ndarray concatenation with numpy operations in tutorials#91
Copilot wants to merge 2 commits intomainfrom
copilot/update-ndarray-in-tutorials

Conversation

Copy link

Copilot AI commented Feb 18, 2026

The pattern [-1] + revenue_locations mixes Python list concatenation with numpy arrays, creating type inconsistency and obscuring intent.

Changes

  • Replaced [-1] + array_name with np.insert(array_name, 0, -1) in both tutorials
  • Updated 4 instances in hillstrom.rst
  • Updated 4 instances in oregon.rst

Example

# Before
locations=[-1] + revenue_locations  # Returns list

# After  
locations=np.insert(revenue_locations, 0, -1)  # Returns ndarray

Both produce functionally equivalent results, but the numpy operation maintains type consistency and clearly expresses the intent to prepend -1 to the array.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…utorials

Co-authored-by: TomeHirata <33407409+TomeHirata@users.noreply.github.com>
Copilot AI changed the title [WIP] Update ndarray operation in tutorial examples Replace list+ndarray concatenation with numpy operations in tutorials Feb 18, 2026
Copilot AI requested a review from TomeHirata February 18, 2026 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants