numpy-best-practices
Installation
SKILL.md
NumPy Best Practices
Expert guidelines for NumPy development, focusing on array programming, numerical computing, and performance optimization.
Code Style and Structure
- Write concise, technical Python code with accurate NumPy examples
- Prefer vectorized operations over explicit loops for performance
- Use descriptive variable names reflecting data content (e.g.,
weights,gradients,input_array) - Follow PEP 8 style guidelines for Python code
- Use functional programming patterns when appropriate
Array Creation and Manipulation
- Use appropriate array creation functions:
np.array(),np.zeros(),np.ones(),np.empty(),np.arange(),np.linspace() - Prefer
np.zeros()ornp.empty()for pre-allocation when array size is known - Use
np.concatenate(),np.vstack(),np.hstack()for combining arrays - Leverage broadcasting for operations on arrays with different shapes