numpy

Enforce NumPy best practices for array creation, dtype selection, and vectorization.

11|2|Updated Feb 18, 2026
One-click install
npx skills add https://github.com/the-perfect-developer/the-perfect-opencode --skill numpy-the-perfect-developer
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: numpy
Source: https://github.com/the-perfect-developer/the-perfect-opencode/tree/main/.opencode/skills/numpy
Command: npx skills add https://github.com/the-perfect-developer/the-perfect-opencode --skill numpy-the-perfect-developer

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

NumPy is the fundamental package for scientific computing with Python and this skill provides best-practice guidance to write efficient, maintainable NumPy code, helping developers optimize performance and memory usage.

Core Features & Use Cases

  • Vectorization over loops: Replace Python loops with NumPy operations to accelerate numerical workflows.
  • Memory layout and dtype choices: Guidance on choosing C vs Fortran order, contiguity, and appropriate data types to save memory and improve cache efficiency.
  • Broadcasting, views and in-place ops: Practical patterns for broadcasting rules, memory views, and safe in-place updates to minimize allocations.
  • Common pitfalls and I/O patterns: Tips on avoiding unnecessary copies, proper reshaping, and efficient I/O for large arrays.

Quick Start

Start by converting a scalar or Python-loop based computation into a vectorized NumPy operation and selecting suitable dtypes for your data.

Frequently Asked Questions about numpy

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I optimize NumPy performance for large array computations?

Optimize NumPy performance by replacing Python loops with vectorized operations, selecting appropriate dtypes, and enforcing memory views to accelerate numerical workflows and improve cache efficiency.

What is the best way to manage memory layout and dtypes in NumPy?

Manage memory layout in NumPy by choosing between C or Fortran order, ensuring array contiguity, and selecting explicit dtypes to save memory and satisfy safe memory patterns during scientific computing.

How does broadcasting work for in-place operations in NumPy?

Broadcasting in NumPy applies dimension-stretching rules to perform element-wise operations without copying data, enabling safe in-place updates and minimizing memory allocations across numerical arrays.

Why does my NumPy code create unnecessary array copies?

NumPy creates unnecessary array copies due to improper reshaping, ignoring array contiguity, or avoiding in-place operations, which can be resolved by applying memory views and safe memory patterns.

When should I use vectorization instead of Python loops for numerical computing?

Use vectorization instead of Python loops whenever processing numerical arrays in NumPy to enforce vectorized operations, bypass Python overhead, and significantly accelerate scientific computing workflows.

What are common NumPy pitfalls when handling large datasets?

Common NumPy pitfalls include ignoring dtype selection, mismanaging memory layout, accidental array copies, and inefficient I/O patterns, which degrade performance and memory usage in large scientific projects.