From 4602a94f025b6ad58d4d5e4145333d4f1436938a Mon Sep 17 00:00:00 2001
From: AnkitSharma <2698ankitsharma@gmail.com>
Date: Tue, 8 Feb 2022 05:48:12 -0500
Subject: [PATCH 1/3] outline
---
Numpy/README.md | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
create mode 100644 Numpy/README.md
diff --git a/Numpy/README.md b/Numpy/README.md
new file mode 100644
index 0000000..12aecd7
--- /dev/null
+++ b/Numpy/README.md
@@ -0,0 +1,17 @@
+# Data-Science-Content-English
+Outline For Numpy
+
+Intro to Numpy
+What is Numpy
+Why Numpy
+ 2-D and Multi-Dimension Array in Numpy
+ Some Function to Create Numpy array
+ Slicing in Numpy array
+ Function in Numpy
+Operators
+Broadcasting
+Mathematical Functions
+Fancy Indexing
+Split Concatenatination
+Some Other Important Numpy Function
+
From 6a0270201871f78f38b679c9c2e1ba32c7c188fa Mon Sep 17 00:00:00 2001
From: Ankit Sharma <67190631+AnkitKumar2698@users.noreply.github.com>
Date: Tue, 8 Feb 2022 19:38:09 +0530
Subject: [PATCH 2/3] Created using Colaboratory
---
Numpy.ipynb | 966 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 966 insertions(+)
create mode 100644 Numpy.ipynb
diff --git a/Numpy.ipynb b/Numpy.ipynb
new file mode 100644
index 0000000..0f82ee7
--- /dev/null
+++ b/Numpy.ipynb
@@ -0,0 +1,966 @@
+{
+ "nbformat": 4,
+ "nbformat_minor": 0,
+ "metadata": {
+ "colab": {
+ "name": "Numpy.ipynb",
+ "provenance": [],
+ "authorship_tag": "ABX9TyPpvvvWTVRFCQBjEbkiaNJM",
+ "include_colab_link": true
+ },
+ "kernelspec": {
+ "name": "python3",
+ "display_name": "Python 3"
+ },
+ "language_info": {
+ "name": "python"
+ }
+ },
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "view-in-github",
+ "colab_type": "text"
+ },
+ "source": [
+ ""
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "id": "lc3MAEJrGa8o"
+ },
+ "outputs": [],
+ "source": [
+ "import numpy as np"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "Creating an array in Numpy\n",
+ "\n"
+ ],
+ "metadata": {
+ "id": "Otueu-eaJSkg"
+ }
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "arr = np.array([1,2,3,4,5])\n",
+ "print(type(arr))\n",
+ "print(arr.ndim)\n"
+ ],
+ "metadata": {
+ "id": "ucQxdTMzHfx_",
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "outputId": "0e03c4cb-6c0d-48a5-a7aa-340f97f387c5"
+ },
+ "execution_count": null,
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "\n",
+ "1\n"
+ ]
+ }
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "Numpy array is Homogeneous"
+ ],
+ "metadata": {
+ "id": "_a0P-5BcMkQW"
+ }
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "\n",
+ "arr = np.array([1,2,3,4,5,6.6])\n",
+ "arr.dtype"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "VQ3F3HHkMZsd",
+ "outputId": "714f7744-526e-4ce8-c49c-99d1689f8542"
+ },
+ "execution_count": null,
+ "outputs": [
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": [
+ "dtype('float64')"
+ ]
+ },
+ "metadata": {},
+ "execution_count": 4
+ }
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "Conversion int to uint8 for Saving Memory"
+ ],
+ "metadata": {
+ "id": "TAZNWxkrM4pW"
+ }
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "\n",
+ "arr.dtype\n",
+ "arr = np.array([1,2,3,4,5],dtype=\"uint8\")\n",
+ "\n",
+ "\n"
+ ],
+ "metadata": {
+ "id": "v1lMijYOM5rX"
+ },
+ "execution_count": null,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "**Time Complexity in Numpy**"
+ ],
+ "metadata": {
+ "id": "2y3T1hhEHepO"
+ }
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "arr = np.array([1, 1, 1, 1, 1, 1, 1, 1,\n",
+ " 1, 1, 1, 1, 1, 1, 1, 1,\n",
+ " 1, 1, 1, 1, 1, 1, 1, 1, \n",
+ " 1, 1, 1, 1, 1, 1, 1, 1,\n",
+ " 1, 1, 1, 1, 1, 1, 1, 1, \n",
+ " 1, 1, 1, 1, 1, 1, 1, 1, \n",
+ " 1, 1, 1, 1, 1, 1, 1, 1, \n",
+ " 1, 1, 1, 1, 1, 1, 1, 1,\n",
+ " 1, 1, 1, 1, 1, 1, 1, 1,\n",
+ " 1, 1, 1, 1, 1, 1, 1, 1,\n",
+ " 1, 1, 1, 1, 1, 1, 1, 1, \n",
+ " 1, 1, 1, 1, 1, 1, 1, 1, \n",
+ " 1, 1, 1, 1, 1, 1, 1, 1,\n",
+ " 1, 1, 1, 1, 1, 1, 1, 1, \n",
+ " 1, 1, 1, 1, 1, 1, 1, 1, \n",
+ " 1, 1, 1, 1, 1, 1, 1, 1,\n",
+ " 1, 1, 1, 1, 1, 1, 1, 1,\n",
+ " 1, 1, 1, 1, 1, 1, 1, 1, \n",
+ " 1, 1, 1, 1, 1, 1, 1, 1, \n",
+ " 1, 1, 1, 1, 1, 1, 1, 1, \n",
+ " 1, 1, 1, 1, 1, 1, 1, 1, \n",
+ " 1, 1, 1, 1, 1, 1, 1, 1])\n",
+ "print(arr)"
+ ],
+ "metadata": {
+ "id": "FC2nFPS9HV9D",
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "outputId": "680b73f1-30f7-464e-cb42-62eacd167c3d"
+ },
+ "execution_count": null,
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n",
+ " 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n",
+ " 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n",
+ " 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n",
+ " 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]\n"
+ ]
+ }
+ ]
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "%timeit sum(arr)"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "9YG7vu4FNeu4",
+ "outputId": "6fd0c6eb-c75e-442d-c4bd-a95eb9a66fb4"
+ },
+ "execution_count": null,
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "10000 loops, best of 5: 32 µs per loop\n"
+ ]
+ }
+ ]
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "%timeit arr.sum()"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "VJeG4DBsOUlZ",
+ "outputId": "95d14d7c-fd68-4e56-b34b-9be1f430abb9"
+ },
+ "execution_count": null,
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "The slowest run took 35.16 times longer than the fastest. This could mean that an intermediate result is being cached.\n",
+ "100000 loops, best of 5: 2.39 µs per loop\n"
+ ]
+ }
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "Important Function to Create Numpy Array"
+ ],
+ "metadata": {
+ "id": "VbPnQ-72O5eC"
+ }
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "arr = [1]*5"
+ ],
+ "metadata": {
+ "id": "JH17DZbjoWYc"
+ },
+ "execution_count": 46,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "arr = np.ones(5) #creating array of 5 size with ones \n",
+ "print(arr)"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "Vs445HwbOdue",
+ "outputId": "520d7282-2b15-418b-f9f4-36f48c66d3be"
+ },
+ "execution_count": null,
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "[1. 1. 1. 1. 1.]\n"
+ ]
+ }
+ ]
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "arr = np.zeros(3,dtype=\"int8\") \n",
+ "print(arr)"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "xvVBzxOqPPub",
+ "outputId": "3f4b2358-f53a-45c9-a879-3625eb120d23"
+ },
+ "execution_count": null,
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "[0 0 0]\n"
+ ]
+ }
+ ]
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "arr = np.arange(2,10,2) #arange function \n",
+ "print(arr) "
+ ],
+ "metadata": {
+ "id": "GWbdfWGSPVvy"
+ },
+ "execution_count": null,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "arr = np.linspace(1,10,50) #linspace\n",
+ "print(arr)"
+ ],
+ "metadata": {
+ "id": "FVfHUVQYjGZc"
+ },
+ "execution_count": null,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "arr = np.random.randn(100)\n",
+ "print(arr)"
+ ],
+ "metadata": {
+ "id": "_RhyeJ03lEC7"
+ },
+ "execution_count": null,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "print(arr.mean(),arr.std())"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "DPMct3yVlPPY",
+ "outputId": "a0fb275c-545d-4420-8452-08e0369ab284"
+ },
+ "execution_count": 30,
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "-0.004647630559591394 0.984123676262071\n"
+ ]
+ }
+ ]
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "np.random.permutation(arr)"
+ ],
+ "metadata": {
+ "id": "JrwmZ361lmgB"
+ },
+ "execution_count": null,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "**2-D array**"
+ ],
+ "metadata": {
+ "id": "SBngt6T-RLzU"
+ }
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "arr = np.array([[1,2,3],[4,5,6],[7,8,9]])\n",
+ "print(arr)\n",
+ "print(arr.ndim)\n",
+ "print(arr.shape)\n",
+ "print(arr.size)\n",
+ "\n",
+ "print(arr[0][1]) #accessing at specific index\n",
+ "print(arr[0,1]) #different method"
+ ],
+ "metadata": {
+ "id": "8xNRE9IhRHB_"
+ },
+ "execution_count": null,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "arr = np.array([[1,2,3],[4,5,6]])\n",
+ "arr.reshape(3,2)"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "MjfGnn3cm2_X",
+ "outputId": "f7cd6edd-0d63-4630-de79-823bc804e7a1"
+ },
+ "execution_count": 38,
+ "outputs": [
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": [
+ "array([[1, 2],\n",
+ " [3, 4],\n",
+ " [5, 6]])"
+ ]
+ },
+ "metadata": {},
+ "execution_count": 38
+ }
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "**Slicing**"
+ ],
+ "metadata": {
+ "id": "fRRwHQJ8PpYM"
+ }
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "arr = np.arange(5,25,2) #created a arr\n",
+ "print(arr)\n",
+ "\n",
+ "\n",
+ "srr=arr[2:5]\n",
+ "\n",
+ "print(srr)"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "Z8zVJ-IiPhMX",
+ "outputId": "60b85376-56e5-4756-f2e8-ef728e591fb8"
+ },
+ "execution_count": null,
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "[ 5 7 9 11 13 15 17 19 21 23]\n",
+ "[ 9 11 13]\n"
+ ]
+ }
+ ]
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "\n",
+ "lst = [1,2,3,4,5] #simple python array\n",
+ "lst2 = lst[2:4] #slicing\n",
+ "print(lst)\n",
+ "print(lst2)\n",
+ "lst2[0] = 1000 #replacing value at index\n",
+ "print(lst)\n",
+ "print(lst2)\n",
+ "\n"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "DrrIVWwYP3gz",
+ "outputId": "867b1d84-672b-45c5-c62a-2fdc29e00c7b"
+ },
+ "execution_count": null,
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "[1, 2, 3, 4, 5]\n",
+ "[3, 4]\n",
+ "[1, 2, 3, 4, 5]\n",
+ "[1000, 4]\n"
+ ]
+ }
+ ]
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "#slicing in 2-D array\n",
+ "arr = np.array([[1,2,3],[4,5,6],[7,8,9]])\n",
+ "print(arr)\n"
+ ],
+ "metadata": {
+ "id": "OUdkGlOXSOuo"
+ },
+ "execution_count": null,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "srr=arr[0:1,1:3]\n",
+ "print(srr)"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "wK4N0KDJSdQQ",
+ "outputId": "1edc1024-0f1e-4c5d-c4af-d65b63afb3a3"
+ },
+ "execution_count": null,
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "[[2 3]]\n"
+ ]
+ }
+ ]
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "arr[::-1,::-1]"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "pAGt5mtqSgid",
+ "outputId": "7c737e3a-300a-4ed7-80a8-ce5d9129816c"
+ },
+ "execution_count": null,
+ "outputs": [
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": [
+ "array([[9, 8, 7],\n",
+ " [6, 5, 4],\n",
+ " [3, 2, 1]])"
+ ]
+ },
+ "metadata": {},
+ "execution_count": 26
+ }
+ ]
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "arr.reshape(-1)"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "X75c2o8dSjrq",
+ "outputId": "e171b110-351e-486c-a6f8-605aad43b7b0"
+ },
+ "execution_count": null,
+ "outputs": [
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": [
+ "array([1, 2, 3, 4, 5, 6, 7, 8, 9])"
+ ]
+ },
+ "metadata": {},
+ "execution_count": 27
+ }
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "**Shallow Copy and Deep Copy**"
+ ],
+ "metadata": {
+ "id": "Au3LZqB6QrId"
+ }
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "lst = np.array([1,2,3,4,5]) #numpy array\n",
+ "lst2 = lst[2:4] #shallow copy\n",
+ "print(lst)\n",
+ "print(lst2)\n",
+ "lst2[0] = 1000 #replacing value at index\n",
+ "print(lst)\n",
+ "print(lst2)\n"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "Kdl762UvQCf_",
+ "outputId": "2be40df0-6be8-4732-e968-50f163a6140c"
+ },
+ "execution_count": null,
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "[1 2 3 4 5]\n",
+ "[3 4]\n",
+ "[ 1 2 1000 4 5]\n",
+ "[1000 4]\n"
+ ]
+ }
+ ]
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "lst = np.array([1,2,3,4,5]) #numpy array\n",
+ "lst2 = lst[2:4].copy() #Deep copy\n",
+ "print(lst)\n",
+ "print(lst2)\n",
+ "lst2[0] = 1000 #replacing value at index\n",
+ "print(lst)\n",
+ "print(lst2)\n"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "pwGdDSvFQ8Oq",
+ "outputId": "1d1b4d42-9116-40e1-b6ef-a7e89f38f4d1"
+ },
+ "execution_count": null,
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "[1 2 3 4 5]\n",
+ "[3 4]\n",
+ "[1 2 3 4 5]\n",
+ "[1000 4]\n"
+ ]
+ }
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "BroadCasting"
+ ],
+ "metadata": {
+ "id": "HNoMk7PHT5eb"
+ }
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "a = np.array([ 1, 2, 34, 4, 5])\n",
+ "print(a+2)\n",
+ "print(a-2)\n",
+ "print(a*2)\n",
+ "print(a/2)"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "G5NzbwBTmgbd",
+ "outputId": "b3a6d877-63f3-4c90-b175-094947bd5744"
+ },
+ "execution_count": 34,
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "[ 3 4 36 6 7]\n",
+ "[-1 0 32 2 3]\n",
+ "[ 2 4 68 8 10]\n",
+ "[ 0.5 1. 17. 2. 2.5]\n"
+ ]
+ }
+ ]
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "print(a>3)\n",
+ "print(a>=3)\n",
+ "print(a<=4)\n",
+ "print(a<2)"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "1Q-EVF0umoLU",
+ "outputId": "84178380-d83f-42b9-d9a2-8085ddd3a6da"
+ },
+ "execution_count": 35,
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "[False False True True True]\n",
+ "[False False True True True]\n",
+ "[ True True False True False]\n",
+ "[ True False False False False]\n"
+ ]
+ }
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "Fancy Indexing"
+ ],
+ "metadata": {
+ "id": "5Tie5Riyner2"
+ }
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "arr = np.array([1,2,3,4,5,6,7,8])"
+ ],
+ "metadata": {
+ "id": "iXTiyLLoms9G"
+ },
+ "execution_count": 39,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "idxArr = [1,4,6]\n",
+ "arr[idxArr]"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "y4GD5QXxniJB",
+ "outputId": "5187be59-5dbc-47a2-cee5-7a75cdcaa4fd"
+ },
+ "execution_count": 41,
+ "outputs": [
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": [
+ "array([2, 5, 7])"
+ ]
+ },
+ "metadata": {},
+ "execution_count": 41
+ }
+ ]
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "arr[[True,False,True,True,True,False,True,True]]"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "sZwQqsCNnm8M",
+ "outputId": "3050833a-adcf-43bd-8a8b-0859392d4c2c"
+ },
+ "execution_count": 42,
+ "outputs": [
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": [
+ "array([1, 3, 4, 5, 7, 8])"
+ ]
+ },
+ "metadata": {},
+ "execution_count": 42
+ }
+ ]
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "arr<=4\n"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "qzdL7_iTnsHU",
+ "outputId": "b49781d9-86f3-4fed-ef47-94613253793d"
+ },
+ "execution_count": 43,
+ "outputs": [
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": [
+ "array([ True, True, True, True, False, False, False, False])"
+ ]
+ },
+ "metadata": {},
+ "execution_count": 43
+ }
+ ]
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "arr[(arr>=2)&(arr<=5)]"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "s5wVNQMjnuLU",
+ "outputId": "2568b16c-719f-4ec3-83aa-a9872cebfb1f"
+ },
+ "execution_count": 44,
+ "outputs": [
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": [
+ "array([2, 3, 4, 5])"
+ ]
+ },
+ "metadata": {},
+ "execution_count": 44
+ }
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "Some Important Function in Numpy"
+ ],
+ "metadata": {
+ "id": "N-mbnWu_oBhW"
+ }
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "np.cos(arr)"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "hy3TuaJBoKqf",
+ "outputId": "6c3d4cdc-3258-4764-8ea4-de7aaa336009"
+ },
+ "execution_count": 57,
+ "outputs": [
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": [
+ "array([0.54030231, 0.54030231, 0.54030231, 0.54030231, 0.54030231])"
+ ]
+ },
+ "metadata": {},
+ "execution_count": 57
+ }
+ ]
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "np.sin(arr)"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "_nNvUsE8pTow",
+ "outputId": "9390c8df-7a73-49c2-e09e-76480d1eb94e"
+ },
+ "execution_count": 58,
+ "outputs": [
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": [
+ "array([0.84147098, 0.84147098, 0.84147098, 0.84147098, 0.84147098])"
+ ]
+ },
+ "metadata": {},
+ "execution_count": 58
+ }
+ ]
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "np.where(arr,100,45)"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "82ZGLrt2pUv4",
+ "outputId": "7c9113dd-2c65-487a-b04f-65c770f01523"
+ },
+ "execution_count": 59,
+ "outputs": [
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": [
+ "array([100, 100, 100, 100, 100])"
+ ]
+ },
+ "metadata": {},
+ "execution_count": 59
+ }
+ ]
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ ""
+ ],
+ "metadata": {
+ "id": "MUWHY_AHqNMU"
+ },
+ "execution_count": null,
+ "outputs": []
+ }
+ ]
+}
\ No newline at end of file
From 6c7aad0948eb8a4c26c16ff8ca0e6b7a880e2d7d Mon Sep 17 00:00:00 2001
From: AnkitSharma <2698ankitsharma@gmail.com>
Date: Wed, 9 Feb 2022 00:58:57 -0500
Subject: [PATCH 3/3] outline update
---
Numpy/README.md | 61 ++++++++++++++++++++++++++++++++++++-------------
1 file changed, 45 insertions(+), 16 deletions(-)
diff --git a/Numpy/README.md b/Numpy/README.md
index 12aecd7..210bcfd 100644
--- a/Numpy/README.md
+++ b/Numpy/README.md
@@ -1,17 +1,46 @@
-# Data-Science-Content-English
-Outline For Numpy
-
-Intro to Numpy
-What is Numpy
-Why Numpy
- 2-D and Multi-Dimension Array in Numpy
- Some Function to Create Numpy array
- Slicing in Numpy array
- Function in Numpy
-Operators
-Broadcasting
-Mathematical Functions
-Fancy Indexing
-Split Concatenatination
-Some Other Important Numpy Function
+# Outline For Numpy
+* Intro to Numpy
+ * What is Numpy
+ * Creating an array in Numpy
+ * Numpy array is Homogeneous
+ * Conversion int to uint8 for Saving Memory
+ * Why Numpy
+ * Time Complexity in Numpy
+ * %timeit sum(arr)
+ * %timeit arr.sum()
+* Creating a Numpy Array
+ * arr = [1]*5
+ * np.zeros(3,dtype="int8"
+ * np.ones(5)
+ * np.arange(2,10,2)
+ * np.linspace(1,10,50)
+ * np.random.randn(100)
+* 2-D and Multi-Dimension Array in Numpy
+ * ndim
+ * shape
+ * size
+ * reshape
+ * Slicing
+ * Shallow Copy and Deep Copy
+* Function in Numpy
+ * Operators
+ * Mathematical Operators
+ * Logical Operators
+ * Broadcasting
+ * Mathematical Functions
+ * mean()
+ * max()
+ * argmin()
+ * argmax()
+ * std()
+ * sum()
+ * add()
+ * Fancy Indexing
+ * Split Concatenatination
+ * Some Other Important Numpy Function
+ * np.cos()
+ * np.sin()
+ * np.where()
+ * np.hstack()
+ * np.vstack()