From dc364a1237542f761fec430c6e17e85e5bf10231 Mon Sep 17 00:00:00 2001 From: Himanshu Ahuja Date: Sat, 6 Apr 2024 18:13:00 -0400 Subject: [PATCH 1/4] Making the introduction more welcoming! --- core/numpy/numpy-basics.ipynb | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/core/numpy/numpy-basics.ipynb b/core/numpy/numpy-basics.ipynb index 2713c3115..3281deb5b 100644 --- a/core/numpy/numpy-basics.ipynb +++ b/core/numpy/numpy-basics.ipynb @@ -14,13 +14,13 @@ "metadata": {}, "source": [ "## Overview\n", - "NumPy is the fundamental package for scientific computing with Python. It contains among other things:\n", + "Welcome to your first Python library - NumPy! NumPy is the fundamental package for numerical operations with Python. It contains among other things:\n", "\n", "- a powerful N-dimensional array object\n", "- sophisticated (broadcasting) functions\n", "- useful linear algebra, Fourier transform, and random number capabilities\n", "\n", - "The NumPy array object is the common interface for working with typed arrays of data across a wide-variety of scientific Python packages. NumPy also features a C-API, which enables interfacing existing Fortran/C/C++ libraries with Python and NumPy. In this notebook we will cover\n", + "Let's get you started with the basics! In this notebook we will cover\n", "\n", "1. Creating an `array`\n", "1. Math and calculations with arrays\n", @@ -1025,7 +1025,20 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.2" + "version": "3.7.15" + }, + "toc": { + "base_numbering": 1, + "nav_menu": {}, + "number_sections": true, + "sideBar": true, + "skip_h1_title": false, + "title_cell": "Table of Contents", + "title_sidebar": "Contents", + "toc_cell": false, + "toc_position": {}, + "toc_section_display": true, + "toc_window_display": false }, "toc-autonumbering": false }, From 7280059aac4c9b757bc56b3fa0850245ae97668e Mon Sep 17 00:00:00 2001 From: Himanshu Ahuja Date: Sat, 6 Apr 2024 18:35:09 -0400 Subject: [PATCH 2/4] Removed pre=requisites, as a in-depth tutorial should not take the student to a tutorial created for an impatient user. --- core/numpy/numpy-basics.ipynb | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/core/numpy/numpy-basics.ipynb b/core/numpy/numpy-basics.ipynb index 3281deb5b..c3bfd3000 100644 --- a/core/numpy/numpy-basics.ipynb +++ b/core/numpy/numpy-basics.ipynb @@ -27,20 +27,6 @@ "1. Inspecting an array with slicing and indexing" ] }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Prerequisites\n", - "\n", - "| Concepts | Importance | Notes |\n", - "| --- | --- | --- |\n", - "| [Python Quickstart](../../foundations/quickstart) | Necessary | Lists, indexing, slicing, math |\n", - "\n", - "* **Time to learn**: 35 minutes\n", - "---" - ] - }, { "cell_type": "markdown", "metadata": {}, From 5ffe0a36a567bbb1340b30444dfe58b1b731fe2e Mon Sep 17 00:00:00 2001 From: Himanshu Ahuja Date: Sat, 6 Apr 2024 18:38:04 -0400 Subject: [PATCH 3/4] A small edit because package imports are never discussed. --- core/numpy/numpy-basics.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/numpy/numpy-basics.ipynb b/core/numpy/numpy-basics.ipynb index c3bfd3000..3bac36527 100644 --- a/core/numpy/numpy-basics.ipynb +++ b/core/numpy/numpy-basics.ipynb @@ -32,12 +32,12 @@ "metadata": {}, "source": [ "## Imports\n", - "A common convention you might encounter is to rename `numpy` to `np` on import to shorten it for the many times we will be calling on `numpy` for functionality." + "You need to import packages into your notebook to be able to use them. A common convention you might encounter is to rename `numpy` to `np` on import to shorten it for the many times we will be calling on `numpy` for functionality." ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ From b24dee6fc25d9545476bacdfb8f83fdf65e4b74b Mon Sep 17 00:00:00 2001 From: Himanshu Ahuja Date: Sat, 6 Apr 2024 18:51:39 -0400 Subject: [PATCH 4/4] Edits on Section 1.3 - Reorganized some instruction. - Added information about dot notation. - Added information on what an import is. --- core/numpy/numpy-basics.ipynb | 143 +++++++++++++++++++++++++++------- 1 file changed, 116 insertions(+), 27 deletions(-) diff --git a/core/numpy/numpy-basics.ipynb b/core/numpy/numpy-basics.ipynb index 3bac36527..8efbebfd6 100644 --- a/core/numpy/numpy-basics.ipynb +++ b/core/numpy/numpy-basics.ipynb @@ -50,14 +50,25 @@ "source": [ "## Create an array of 'data'\n", "\n", - "The NumPy array represents a *contiguous* block of memory, holding entries of a given type (and hence fixed size). The entries are laid out in memory according to the shape, or list of dimension sizes. Let's start by creating an array from a list of integers and taking a look at it," + "The NumPy array represents a *contiguous* block of memory, holding entries of a given type (and hence fixed size). Let's start by creating an array from a list of integers and taking a look at it," ] }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([1, 2, 3])" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "a = np.array([1, 2, 3])\n", "a" @@ -67,23 +78,45 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "We can inspect the number of dimensions our array is organized along with `ndim`, and how long each of these dimensions are with `shape`" + "The entries of the array are laid out in memory according to the shape, or list of dimension sizes. We can inspect the number of dimensions of our array with `ndim`, and how long each of these dimensions are with `shape`. " ] }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "1" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "a.ndim" ] }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(3,)" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "a.shape" ] @@ -92,14 +125,25 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "So our 1-dimensional array has a shape of `3` along that dimension! Finally we can check out the underlying type of our underlying data," + "So our 1-dimensional array has a shape of `3` along that dimension! The dot `(.)` notation helps you access various `properties` of the NumPy array. Finally, we can check out the underlying type of our underlying data," ] }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "dtype('int64')" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "a.dtype" ] @@ -113,9 +157,21 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([[1., 2., 3.],\n", + " [4., 5., 6.]])" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "a = np.array([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]])\n", "a" @@ -123,27 +179,60 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "2" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "a.ndim" ] }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(2, 3)" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "a.shape" ] }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "dtype('float64')" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "a.dtype" ]