{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "118f247b",
   "metadata": {},
   "source": [
    "# NumPy Arrays\n",
    "\n",
    "<h2>Overview</h2>\n",
    "\n",
    "NumPy gives Python a fast, compact way to represent and compute with numerical collections. In this chapter, you will move from ordinary Python lists to arrays that can store business quantities, support whole-column calculations, and make simulation practical.\n",
    "\n",
    "- NumPy arrays store numerical data in structured, efficient collections.\n",
    "- Array shape, size, dimension, and data type describe how values are organized.\n",
    "- Indexing and slicing select specific values, rows, columns, or ranges.\n",
    "- Vectorized operations and universal functions apply calculations to whole arrays without manual loops.\n",
    "- Random number generation supports simulation and uncertainty modeling in management decisions.\n",
    "\n",
    "The chapter has three sections. The first introduces array creation, attributes, indexing, and reshaping. The second shows how vectorized computation, universal functions, aggregation, broadcasting, masking, and sorting make array work efficient. The third introduces random number generation and simulation."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "dd17f007",
   "metadata": {},
   "source": [
    "<h2>Chapter Video</h2>\n",
    "\n",
    "<iframe width=\"560\" height=\"315\"\n",
    "src=\"https://www.youtube-nocookie.com/embed/QUT1VHiLmmI\"\n",
    "  frameborder=\"0\"\n",
    "  allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\"\n",
    "  allowfullscreen\n",
    "  referrerpolicy=\"strict-origin-when-cross-origin\"></iframe>\n",
    "\n",
    "<div class=\"video-credit\">\n",
    "<p><strong>Video credit:</strong> <em><a href=\"https://www.youtube.com/watch?v=QUT1VHiLmmI\">Python NumPy Tutorial for Beginners</a></em> by freeCodeCamp.org.</p>\n",
    "<p class=\"video-rights\">This embedded video is provided for educational reference only. All rights are retained by the respective copyright holder.</p>\n",
    "</div>\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3b04481c",
   "metadata": {},
   "source": [
    "<h2>Learning Objectives</h2>\n",
    "\n",
    "By the end of this chapter, you will be able to:\n",
    "\n",
    "1. Create NumPy arrays from Python data and inspect their shape, size, dimension, and data type.\n",
    "2. Select and reshape array values using indexing, slicing, boolean masks, and shape-changing methods.\n",
    "3. Apply vectorized operations and universal functions to compute efficiently across arrays.\n",
    "4. Summarize and compare arrays with aggregation, axis-based operations, broadcasting, sorting, and fancy indexing.\n",
    "5. Use NumPy random generators to produce reproducible samples and simple simulations for business uncertainty."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f98f3cdf",
   "metadata": {},
   "source": [
    "<h2>Chapter Flow</h2>\n",
    "\n",
    "```{div} chapter-flow\n",
    "{doc}`Arrays Basics <0301-np-basics>`\n",
    "\n",
    "{doc}`Array Computation <0302-np-ufuncs>`\n",
    "\n",
    "{doc}`Random Number Generation <0303-np-random>`\n",
    "```\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f7c68868",
   "metadata": {},
   "source": [
    "<h2>Glossary</h2>\n",
    "\n",
    "| # | Term | Explanation |\n",
    "|---:|---|---|\n",
    "| 1 | NumPy | A Python library for fast numerical computing with arrays. |\n",
    "| 2 | Array | A structured collection of values that NumPy can process efficiently. |\n",
    "| 3 | `ndarray` | NumPy's N-dimensional array object, used to store homogeneous values. |\n",
    "| 4 | Dimension | One direction or level of an array, such as rows, columns, or deeper axes. |\n",
    "| 5 | Axis | A numbered direction along which NumPy organizes or reduces array values. |\n",
    "| 6 | Shape | A tuple that reports the length of an array along each axis. |\n",
    "| 7 | Size | The total number of elements in an array. |\n",
    "| 8 | `dtype` | The NumPy data type used to store the values in an array. |\n",
    "| 9 | Homogeneous array | An array whose elements all share one data type. |\n",
    "| 10 | Scalar | A single numerical value. |\n",
    "| 11 | Vector | A one-dimensional array of values. |\n",
    "| 12 | Matrix | A two-dimensional array organized by rows and columns. |\n",
    "| 13 | Tensor | An array with three or more dimensions, or a general term for multidimensional arrays. |\n",
    "| 14 | Indexing | Selecting an array element by position. |\n",
    "| 15 | Slicing | Selecting a range of elements from an array. |\n",
    "| 16 | Boolean mask | An array of `True` and `False` values used to filter or modify another array. |\n",
    "| 17 | Fancy indexing | Selecting array values with arrays or lists of integer positions. |\n",
    "| 18 | Reshaping | Changing an array's shape without changing its underlying values. |\n",
    "| 19 | Transpose | An operation that swaps array axes, often turning rows into columns. |\n",
    "| 20 | Broadcasting | NumPy's rule system for combining arrays with compatible but different shapes. |\n",
    "| 21 | Vectorized operation | An operation applied to whole arrays at once instead of through an explicit Python loop. |\n",
    "| 22 | Universal function | A NumPy function, or ufunc, that applies fast element-wise operations to arrays. |\n",
    "| 23 | Element-wise operation | A calculation performed separately on corresponding elements of an array. |\n",
    "| 24 | Aggregation | A calculation that summarizes many values into fewer values, often one value. |\n",
    "| 25 | Axis parameter | A function argument that controls which array direction an operation works across. |\n",
    "| 26 | Sorting | Arranging array values in order. |\n",
    "| 27 | View | An array object that refers to data owned by another array. |\n",
    "| 28 | Copy | A separate array with its own data. |\n",
    "| 29 | Random number generator | A tool that produces pseudorandom values for sampling and simulation. |\n",
    "| 30 | Seed | A starting value that makes a pseudorandom sequence reproducible. |\n",
    "| 31 | `default_rng()` | NumPy's recommended function for creating a modern random-number generator. |\n",
    "| 32 | Uniform distribution | A distribution where values in a range are equally likely. |\n",
    "| 33 | Normal distribution | A bell-shaped distribution described by a mean and standard deviation. |\n",
    "| 34 | Sampling | Selecting values randomly from a population, list, or distribution. |\n",
    "| 35 | Simulation | Repeatedly using random values to model uncertainty or possible outcomes. |"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "47c258e5",
   "metadata": {},
   "source": [
    "<h2><a href=\"overview.html\" target=\"_blank\" style=\"color: var(--pst-color-link, #176de8);\">Chapter Overview Slides</a></h2>"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.13.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
