Skip to content

Shubham496/numpy-tutorial

Repository files navigation

NumPy Learning Repository

Welcome to the NumPy Learning Repository! This repository contains a collection of examples, exercises, and explanations to help you learn and understand the fundamentals of NumPy — the core scientific computing library in Python.

Whether you're a beginner or looking to sharpen your NumPy skills, this repo will guide you through the key concepts and functions.

Table of Contents

Introduction

NumPy (Numerical Python) is a powerful library for numerical computations and handling large multi-dimensional arrays and matrices. It provides a wide range of mathematical functions to operate on arrays and is widely used in data science, machine learning, and scientific computing.

Installation

To install NumPy, simply run the following command in your terminal:

pip install numpy

Usage

Here's a simple example to get you started with NumPy:

import numpy as np

# Create a 1D array
arr = np.array([1, 2, 3, 4, 5])
print(arr)

# Perform an operation
print("Sum:", np.sum(arr))

Key Concepts

Arrays

NumPy arrays are the core data structure. They are similar to Python lists but offer more functionality and better performance for numerical operations.

# Creating arrays
a = np.array([1, 2, 3])
b = np.array([[1, 2], [3, 4]])

Array Operations

NumPy supports element-wise operations, aggregation, and more.

a = np.array([1, 2, 3])
b = np.array([4, 5, 6])
print(a + b)  # [5 7 9]
print(a * b)  # [ 4 10 18]

Indexing and Slicing

You can access and modify array elements using indexing and slicing.

arr = np.array([10, 20, 30, 40])
print(arr[1:3])  # [20 30]

Broadcasting

Broadcasting allows NumPy to perform operations on arrays of different shapes.

a = np.array([1, 2, 3])
b = 2
print(a * b)  # [2 4 6]

Examples

Explore the examples/ directory for hands-on code samples covering:

  • Array creation and manipulation
  • Mathematical operations
  • Linear algebra
  • Random number generation
  • And more!

Contributing

Contributions are welcome! Please open issues or submit pull requests to help improve this repository.

License

This project is licensed under the MIT License.

Contact Me

Feel free to reach out if you have any questions, suggestions, or just want to connect!

I look forward to hearing from you!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published