From 954cf2d680ec37a4eae1efd593b55782d7152416 Mon Sep 17 00:00:00 2001 From: Asabeneh Date: Fri, 13 Dec 2019 21:04:24 +0200 Subject: [PATCH] day 24 fixes --- .ipynb_checkpoints/test-checkpoint.ipynb | 2287 +++++++++++++++++++ readme22-24.md | 1060 ++++++--- test.ipynb | 2606 ++++++++++++++++++++++ test.md | 1504 +++++++++++++ test0.md | 1031 +++++++++ test_files/test_121_0.png | Bin 0 -> 5168 bytes test_files/test_141_0.png | Bin 0 -> 12639 bytes test_files/test_143_0.png | Bin 0 -> 12867 bytes 8 files changed, 8219 insertions(+), 269 deletions(-) create mode 100644 .ipynb_checkpoints/test-checkpoint.ipynb create mode 100644 test.ipynb create mode 100644 test.md create mode 100644 test0.md create mode 100644 test_files/test_121_0.png create mode 100644 test_files/test_141_0.png create mode 100644 test_files/test_143_0.png diff --git a/.ipynb_checkpoints/test-checkpoint.ipynb b/.ipynb_checkpoints/test-checkpoint.ipynb new file mode 100644 index 00000000..6ef765f0 --- /dev/null +++ b/.ipynb_checkpoints/test-checkpoint.ipynb @@ -0,0 +1,2287 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Day 24\n", + "\n", + "## Python for Statistical Analysis\n", + "\n", + "### Statistics\n", + "\n", + "Statistics is the discipline that concerns the _collection_, _organization_, _displaying_, _analysis_, _interpretation_ and _presentation_ of data.\n", + "Statistics is a sub field of mathematics that is universally agreed to be a prerequisite for a deeper understanding of data science and machine learning. Statistics is a very broad field but we will focus in this section only on the most relevant part.\n", + "After completing this challenge, you may go to web development, data analysis, machine learning and data science path. Whatever path you may follow, at some point you will in your career you will get data which you may work on.\n", + "\n", + "### Data\n", + "\n", + "What is data? Data is any set of characters that is gathered and translated for some purpose, usually analysis. It can be any character, including text and numbers, pictures, sound, or video. If data is not put into context, it doesn't do anything to a human or computer. To make sense from data we need to work on the data using different tools.\n", + "The work flow of data analysis, data science or machine learning starts from data.\n", + "Either we create or get data. Data can be found as small or big data format. Most of the data types we will get have been covered in the file handling section.\n", + "\n", + "### Statistics Module\n", + "\n", + "The python _statistics_ module provides functions for calculating mathematical statistics of numeric data. The module is not intended to be a competitor to third-party libraries such as NumPy, SciPy, or proprietary full-featured statistics packages aimed at professional statisticians such as Minitab, SAS and Matlab. It is aimed at the level of graphing and scientific calculators.\n", + "\n", + "## NumPy\n", + "\n", + "In the first section we defined python as a great general-purpose programming language on its own, but with the help of other popular libraries (numpy, scipy, matplotlib, pandas etc) it becomes a powerful environment for scientific computing.\n", + "\n", + "Numpy is the core library for scientific computing in Python. It provides a high-performance multidimensional array object, and tools for working with arrays.\n", + "\n", + "So far, we have been using vscode but from now on I would recommend using Jupyter Notebook. To access jupter notebook let's install [anaconda](https://www.anaconda.com/). If you are using anaconda most of the common packages are included and you don't have install packages if you installed anaconda." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "attributes": { + "classes": [ + "sh" + ], + "id": "" + } + }, + "outputs": [], + "source": [ + "asabeneh@Asabeneh:~/Desktop/30DaysOfPython$ pip install numpy" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Importing NumPy\n", + "\n", + "Jupyter notebook is available if your are in favor of [jupyter notebook](https://github.com/Asabeneh/data-science-for-everyone/blob/master/numpy/numpy.ipynb)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "attributes": { + "classes": [ + "py" + ], + "id": "" + } + }, + "outputs": [], + "source": [ + "# How to import numpy\n", + "import numpy as np\n", + "# How to check the version of the numpy package\n", + "print('numpy:', np.__version__)\n", + "# Checking the available methods\n", + "print(dir(np))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Creating numpy array using" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "attributes": { + "classes": [ + "py" + ], + "id": "" + } + }, + "outputs": [], + "source": [ + "# Creating python List\n", + "python_list = [1,2,3,4,5]\n", + "# Checking data types\n", + "print(type (python_list))\n", + "print(python_list)\n", + "two_dimensional_list = [[0,1,2], [3,4,5], [6,7,8]]\n", + "print(two_dimensional_list)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "attributes": { + "classes": [ + "sh" + ], + "id": "" + } + }, + "outputs": [], + "source": [ + "\n", + "[1 2 3 4 5]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "attributes": { + "classes": [ + "py" + ], + "id": "" + } + }, + "outputs": [], + "source": [ + "# Creating Numpy(Numerical Python) array from python list\n", + "numpy_array_from_list = np.array(python_list)\n", + "print(type (numpy_array_from_list))\n", + "print(numpy_array_from_list)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Creating list with a float data type" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "attributes": { + "classes": [ + "py" + ], + "id": "" + } + }, + "outputs": [], + "source": [ + "python_list = [1,2,3,4,5]\n", + "numy_array_from_list2 = np.array(python_list, dtype=float)\n", + "print(numy_array_from_list2)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "attributes": { + "classes": [ + "sh" + ], + "id": "" + } + }, + "outputs": [], + "source": [ + "array([1., 2., 3., 4., 5.])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Creating list with a boolean data type" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "attributes": { + "classes": [ + "py" + ], + "id": "" + } + }, + "outputs": [], + "source": [ + "numpy_bool_array = np.array([0, 1, -1, 0, 0], dtype=bool)\n", + "print(numpy_bool_array)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "attributes": { + "classes": [ + "sh" + ], + "id": "" + } + }, + "outputs": [], + "source": [ + "array([False, True, True, False, False])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Creating multidimensional array using numpy" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "attributes": { + "classes": [ + "py" + ], + "id": "" + } + }, + "outputs": [], + "source": [ + "two_dimensional_list = [[0,1,2], [3,4,5], [6,7,8]]\n", + "numpy_two_dimensional_list = np.array(two_dimensional_list)\n", + "print(type (numpy_two_dimensional_list))\n", + "print(numpy_two_dimensional_list)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "attributes": { + "classes": [ + "sh" + ], + "id": "" + } + }, + "outputs": [], + "source": [ + "array([[0, 1, 2],\n", + " [3, 4, 5],\n", + " [6, 7, 8]])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Converting numpy array to list" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "attributes": { + "classes": [ + "py" + ], + "id": "" + } + }, + "outputs": [], + "source": [ + "# We can always convert an array back to a python list using tolist().\n", + "np_to_list = numpy_array_from_list.tolist()\n", + "print(type (np_to_list))\n", + "print('one dimensional array:', np_to_list)\n", + "print('two dimensional array: ', numpy_two_dimensional_list.tolist())" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "attributes": { + "classes": [ + "sh" + ], + "id": "" + } + }, + "outputs": [], + "source": [ + "\n", + "one dimensional array: [1, 2, 3, 4, 5]\n", + "two dimensional array: [[0, 1, 2], [3, 4, 5], [6, 7, 8]]" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Creating numpy array from tuple" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "attributes": { + "classes": [ + "py" + ], + "id": "" + } + }, + "outputs": [], + "source": [ + "# Numpy array from tuple\n", + "# Creating tuple in Python\n", + "\n", + "python_tuple = (1,2,3,4,5)\n", + "print(type (python_tuple))\n", + "print('python_tuple: ', python_tuple)\n", + "\n", + "numpy_array_from_tuple = np.array(python_tuple)\n", + "print(type (numpy_array_from_tuple))\n", + "print('numpy_array_from_tuple: ', numpy_array_from_tuple)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "attributes": { + "classes": [ + "sh" + ], + "id": "" + } + }, + "outputs": [], + "source": [ + "\n", + "python_tuple: (1, 2, 3, 4, 5)\n", + "\n", + "numpy_array_from_tuple: array([1, 2, 3, 4, 5])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Shape of numpy array\n", + "\n", + "The shape method provide the shape of the array as a tuple. The first is the row and the second is the column" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "attributes": { + "classes": [ + "py" + ], + "id": "" + } + }, + "outputs": [], + "source": [ + "nums = np.array([1, 2, 3, 4, 5])\n", + "print(nums)\n", + "print('shape of nums: ', nums.shape)\n", + "print(numpy_two_dimensional_list)\n", + "print('shape of numpy_two_dimensional_list: ', numpy_two_dimensional_list.shape)\n", + "three_by_four_array = np.array([[0, 1, 2, 3],\n", + " [4,5,6,7],\n", + " [8,9,10, 11]])\n", + "print(three_by_four_array.shape)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "attributes": { + "classes": [ + "sh" + ], + "id": "" + } + }, + "outputs": [], + "source": [ + "[1 2 3 4 5]\n", + "shape of nums: (5,)\n", + "[[0 1 2]\n", + "[3 4 5]\n", + "[6 7 8]]\n", + "shape of numpy_two_dimensional_list: (3, 3)\n", + "(3, 4)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Data type of numpy array\n", + "\n", + "Type of data types: str, int, float, complex, bool, list, None" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "attributes": { + "classes": [ + "py" + ], + "id": "" + } + }, + "outputs": [], + "source": [ + "int_lists = [-3, -2, -1, 0, 1, 2,3]\n", + "int_array = np.array(int_lists)\n", + "float_array = np.array(int_lists, dtype=float)\n", + "\n", + "print(int_array)\n", + "print(int_array.dtype)\n", + "print(float_array)\n", + "print(float_array.dtype)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "attributes": { + "classes": [ + "sh" + ], + "id": "" + } + }, + "outputs": [], + "source": [ + "[-3 -2 -1 0 1 2 3]\n", + "int64\n", + "[-3. -2. -1. 0. 1. 2. 3.]\n", + "float64" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Size of a numpy array\n", + "In addition to *len* we can also use size to get the number of items in a numpy array" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "attributes": { + "classes": [ + "py" + ], + "id": "" + } + }, + "outputs": [], + "source": [ + "numpy_array_from_list = np.array([1, 2, 3, 4, 5])\n", + "two_dimensional_list = np.array([[0, 1, 2],\n", + " [3, 4, 5],\n", + " [6, 7, 8]])\n", + "print(len(numpy_array_from_list)) # 5\n", + "print(len(two_dimensional_list)) # 3\n", + "\n", + "print(numpy_array_from_list.size) # 5\n", + "print(two_dimensional_list.size) # 3\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Mathematical Operation" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "attributes": { + "classes": [ + "py" + ], + "id": "" + } + }, + "outputs": [], + "source": [ + "# Mathematical Operation\n", + "# Addition\n", + "print('original array: ', numpy_array_from_list)\n", + "ten_plus_original = numpy_array_from_list + 10\n", + "print(ten_plus_original)\n", + "ten_minus_original = numpy_array_from_list - 10\n", + "print(ten_minus_original)\n", + "# Multiplication\n", + "ten_times_original = numpy_array_from_list * 10\n", + "print(ten_times_original)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "attributes": { + "classes": [ + "sh" + ], + "id": "" + } + }, + "outputs": [], + "source": [ + "original array: [1 2 3 4 5]\n", + "[11 12 13 14 15]\n", + "[-9 -8 -7 -6 -5]\n", + "[10 20 30 40 50]" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Checking numpy array data types" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "attributes": { + "classes": [ + "py" + ], + "id": "" + } + }, + "outputs": [], + "source": [ + "#Int, Float numbers\n", + "\n", + "numpy_int_list = np.array([1,2,3,4])\n", + "numpy_float_list = np.array([1.1, 2.0,3.2])\n", + "numpy_float_list2 = np.array([1.1,2.0,3.2])\n", + "\n", + "print(numpy_int_list.dtype)\n", + "print(numpy_float_list2.dtype)\n", + "print(numpy_float_list.dtype)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "attributes": { + "classes": [ + "sh" + ], + "id": "" + } + }, + "outputs": [], + "source": [ + "int64\n", + "float64\n", + "float64" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Converting types" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "attributes": { + "classes": [ + "py" + ], + "id": "" + } + }, + "outputs": [], + "source": [ + "# Converting type from float to int\n", + "numpy_float_list = np.array([1.1, 2.0,3.2])\n", + "numpy_float_list.astype('int')\n", + "print(numpy_float_list)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "attributes": { + "classes": [ + "sh" + ], + "id": "" + } + }, + "outputs": [], + "source": [ + "array([1, 2, 3])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "attributes": { + "classes": [ + "py" + ], + "id": "" + } + }, + "outputs": [], + "source": [ + "# Converting type from int to str\n", + "numpy_float_list.astype('int').astype('str')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "attributes": { + "classes": [ + "sh" + ], + "id": "" + } + }, + "outputs": [], + "source": [ + "array(['1', '2', '3'], dtype='\n", + "[[1 2 3]\n", + " [4 5 6]\n", + " [7 8 9]]\n", + "Shape: (3, 3)\n", + "Size: 9\n", + "Data type: int64" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Getting items from a numpy array" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "attributes": { + "classes": [ + "py" + ], + "id": "" + } + }, + "outputs": [], + "source": [ + "# 2 Dimension Array\n", + "two_dimension_array = np.array([[1,2,3],[4,5,6], [7,8,9]])\n", + "first_row = two_dimension_array[0]\n", + "second_row = two_dimension_array[1]\n", + "third_row = two_dimension_array[2]\n", + "print('First row:', first_row)\n", + "print('Second row:', second_row)\n", + "print('Third row: ', third_row)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "attributes": { + "classes": [ + "sh" + ], + "id": "" + } + }, + "outputs": [], + "source": [ + "First row: [1 2 3]\n", + "Second row: [4 5 6]\n", + "Third row: [7 8 9]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "attributes": { + "classes": [ + "py" + ], + "id": "" + } + }, + "outputs": [], + "source": [ + "first_column= two_dimension_array[:,0]\n", + "second_column = two_dimension_array[:,1]\n", + "third_column = two_dimension_array[:,2]\n", + "print('First column:', first_column)\n", + "print('Second column:', second_column)\n", + "print('Third column: ', third_column)\n", + "print(two_dimension_array)\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "attributes": { + "classes": [ + "sh" + ], + "id": "" + } + }, + "outputs": [], + "source": [ + "First column: [1 4 7]\n", + "Second column: [2 5 8]\n", + "Third column: [3 6 9]\n", + "[[1 2 3]\n", + " [4 5 6]\n", + " [7 8 9]]" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Slicing in numpy is similar to slicing in python list" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "attributes": { + "classes": [ + "py" + ], + "id": "" + } + }, + "outputs": [], + "source": [ + "first_two_rows_and_columns = two_dimension_array[0:2, 0:2]\n", + "print(first_two_rows_and_columns)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "attributes": { + "classes": [ + "sh" + ], + "id": "" + } + }, + "outputs": [], + "source": [ + "array([[1, 2],\n", + " [4, 5]])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### How to reverse the rows and the whole array?" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "two_dimension_array[::]\n", + "```\n", + " array([[1, 2, 3],\n", + " [4, 5, 6],\n", + " [7, 8, 9]])\n", + "\n", + "\n", + "### Reverse only the row positions\n", + "\n", + "\n", + "```python\n", + "two_dimension_array[::-1,]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "array([[7, 8, 9],\n", + " [4, 5, 6],\n", + " [1, 2, 3]])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Reverse the row and column positions" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "two_dimension_array[::-1,::-1]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "array([[9, 8, 7],\n", + " [6, 5, 4],\n", + " [3, 2, 1]])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## How to represent missing values and infinite?" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "print(two_dimension_array)\n", + "two_dimension_array[1,1] = 55\n", + "two_dimension_array[1,2] =44\n", + "print(two_dimension_array)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "[[1 2 3]\n", + " [4 5 6]\n", + " [7 8 9]]\n", + "[[ 1 2 3]\n", + " [ 4 55 44]\n", + " [ 7 8 9]]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Numpy Zeroes\n", + "# numpy.zeros(shape, dtype=float, order='C')\n", + "numpy_zeroes = np.zeros((3,3),dtype=int,order='C')\n", + "numpy_zeroes" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "array([[0, 0, 0],\n", + " [0, 0, 0],\n", + " [0, 0, 0]])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Numpy Zeroes\n", + "numpy_ones = np.ones((3,3),dtype=int,order='C')\n", + "print(numpy_ones)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "[[1 1 1]\n", + " [1 1 1]\n", + " [1 1 1]]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "twoes = numpy_ones * 2" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Reshape\n", + "# numpy.reshape(), numpy.flatten()\n", + "first_shape = np.array([(1,2,3), (4,5,6)])\n", + "print(first_shape)\n", + "reshaped = first_shape.reshape(3,2)\n", + "print(reshaped)\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "[[1 2 3]\n", + " [4 5 6]]\n", + "[[1 2]\n", + " [3 4]\n", + " [5 6]]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "flattened = reshaped.flatten()\n", + "flattened" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "array([1, 2, 3, 4, 5, 6])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "## Horitzontal Stack\n", + "np_list_one = np.array([1,2,3])\n", + "np_list_two = np.array([4,5,6])\n", + "\n", + "print(np_list_one + np_list_two)\n", + "\n", + "print('Horizontal Append:', np.hstack((np_list_one, np_list_two)))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "[5 7 9]\n", + "Horizontal Append: [1 2 3 4 5 6]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "## Vertical Stack\n", + "print('Vertical Append:', np.vstack((np_list_one, np_list_two)))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "Vertical Append: [[1 2 3]\n", + " [4 5 6]]" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Generating Random Numbers" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Generate a random float number\n", + "random_float = np.random.random()\n", + "random_float" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "0.6661632875670657" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Generate a random float number\n", + "random_floats = np.random.random(5)\n", + "random_floats" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "array([0.12945387, 0.1859908 , 0.47805876, 0.51996342, 0.52458233])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Generating a random integers between 0 and 10\n", + "random_int = np.random.randint(0, 11)\n", + "random_int" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "7" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Generating a random integers between 2 and 11, and creating a one row array\n", + "random_int = np.random.randint(2,10, size=4)\n", + "random_int" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "array([5, 8, 8, 9])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Generating a random integers between 0 and 10\n", + "random_int = np.random.randint(2,10, size=(3,3))\n", + "random_int" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "array([[8, 9, 5],\n", + " [9, 8, 3],\n", + " [2, 3, 8]])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Generate random numbers\n", + "# np.random.normal(mu, sigma, size)\n", + "normal_array = np.random.normal(79, 15, 80)\n", + "normal_array\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "array([ 76.67233671, 87.8686846 , 64.80771996, 79.44136527,\n", + " 68.83066184, 102.85967631, 74.40838573, 58.56053793,\n", + " 93.76814784, 82.16082568, 86.80548555, 77.95291907,\n", + " 97.71514434, 95.94083876, 82.53018033, 73.74619803,\n", + " 67.07970869, 102.20984782, 81.67766599, 73.82096132,\n", + " 90.17632538, 102.87342877, 84.19855251, 81.11888938,\n", + " 63.42782472, 75.3734846 , 79.04423914, 56.52607352,\n", + " 58.30505483, 54.69555571, 63.25792739, 88.75239018,\n", + " 85.44533248, 59.76883843, 39.72683784, 78.1029094 ,\n", + " 54.19952262, 82.383277 , 87.01010766, 73.09642208,\n", + " 81.99276776, 82.58990091, 72.71303439, 101.73499367,\n", + " 73.65596295, 81.89611334, 96.14703307, 74.9629613 ,\n", + " 84.79491744, 90.77830881, 70.69085365, 69.27799996,\n", + " 74.07836137, 56.79410721, 76.08072393, 83.28246182,\n", + " 83.66382654, 80.79644627, 83.39674788, 73.68044176,\n", + " 59.74405724, 47.50763054, 50.99870066, 85.53776901,\n", + " 80.61131428, 62.66726385, 69.8289171 , 58.2394869 ,\n", + " 86.5158869 , 86.92976422, 65.12965299, 101.9918336 ,\n", + " 73.3855881 , 99.29788439, 82.48238578, 83.14592314,\n", + " 109.13987986, 87.18461073, 73.18647475, 76.04712709,\n", + "\n", + " ])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Numpy and Statistics" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import matplotlib.pyplot as plt\n", + "import seaborn as sns\n", + "sns.set()\n", + "plt.hist(normal_array, color=\"grey\", bins=50)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "(array([ 1., 0., 1., 2., 0., 1., 3., 3., 4., 2., 4., 10., 7.,\n", + " 12., 15., 13., 20., 26., 16., 32., 36., 42., 38., 37., 35., 54.,\n", + " 50., 40., 40., 55., 56., 49., 45., 29., 37., 26., 26., 23., 28.,\n", + " 12., 22., 10., 11., 5., 3., 6., 4., 4., 3., 2.]),\n", + " array([ 26.42484343, 28.2913796 , 30.15791576, 32.02445192,\n", + " 33.89098809, 35.75752425, 37.62406041, 39.49059657,\n", + " 41.35713274, 43.2236689 , 45.09020506, 46.95674123,\n", + " 48.82327739, 50.68981355, 52.55634972, 54.42288588,\n", + " 56.28942204, 58.1559582 , 60.02249437, 61.88903053,\n", + " 63.75556669, 65.62210286, 67.48863902, 69.35517518,\n", + " 71.22171134, 73.08824751, 74.95478367, 76.82131983,\n", + " 78.687856 , 80.55439216, 82.42092832, 84.28746449,\n", + " 86.15400065, 88.02053681, 89.88707297, 91.75360914,\n", + " 93.6201453 , 95.48668146, 97.35321763, 99.21975379,\n", + " 101.08628995, 102.95282611, 104.81936228, 106.68589844,\n", + " 108.5524346 , 110.41897077, 112.28550693, 114.15204309,\n", + " 116.01857926, 117.88511542, 119.75165158]),\n", + " )" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# numpy.asarray()\n", + "# Asarray\n", + "# The asarray()function is used when you want to convert an input to an array.\n", + "# The input could be a lists, tuple, ndarray, etc." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "four_by_four_matrix = np.matrix(np.ones((4,4), dtype=float))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "four_by_four_matrix" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "matrix([[1., 1., 1., 1.],\n", + " [1., 1., 1., 1.],\n", + " [1., 1., 1., 1.],\n", + " [1., 1., 1., 1.]])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "np.asarray(four_by_four_matrix)[2] = 2\n", + "four_by_four_matrix" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "matrix([[1., 1., 1., 1.],\n", + " [1., 1., 1., 1.],\n", + " [2., 2., 2., 2.],\n", + " [1., 1., 1., 1.]])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# numpy.arange() in Python with Example\n", + "# Whay is Arrange?\n", + "# Sometimes, you want to create values that are evenly spaced within a defined interval.\n", + "# For instance, you want to create values from 1 to 10; you can use numpy.arange() function\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# creating list using range(starting, stop, step)\n", + "lst = range(0, 11, 2)\n", + "lst" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "range(0, 11, 2)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "for l in lst:\n", + " print(l)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "0\n", + " 2\n", + " 4\n", + " 6\n", + " 8\n", + " 10" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Similar to range arange numpy.arange(start, stop, step)\n", + "whole_numbers = np.arange(0, 20, 1)\n", + "whole_numbers" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,\n", + " 17, 18, 19])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "natural_numbers = np.arange(1, 20, 1)\n", + "natural_numbers" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "array([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,\n", + " 18, 19])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "odd_numbers = np.arange(1, 20, 2)\n", + "odd_numbers" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "array([ 1, 3, 5, 7, 9, 11, 13, 15, 17, 19])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "even_numbers = np.arange(2, 20, 2)\n", + "even_numbers" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "array([ 2, 4, 6, 8, 10, 12, 14, 16, 18])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# numpy.linspace()\n", + "# numpy.logspace() in Python with Example\n", + "# For instance, it can be used to create 10 values from 1 to 5 evenly spaced.\n", + "np.linspace(1.0, 5.0, num=10)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "array([1. , 1.44444444, 1.88888889, 2.33333333, 2.77777778,\n", + " 3.22222222, 3.66666667, 4.11111111, 4.55555556, 5. ])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# not to include the last value in the interval\n", + "np.linspace(1.0, 5.0, num=5, endpoint=False)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "array([1. , 1.8, 2.6, 3.4, 4.2])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# LogSpace\n", + "# LogSpace returns even spaced numbers on a log scale. Logspace has the same parameters as np.linspace.\n", + "\n", + "# Syntax:\n", + "\n", + "# numpy.logspace(start, stop, num, endpoint)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "np.logspace(2, 4.0, num=4)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "array([ 100. , 464.15888336, 2154.43469003, 10000. ])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# to check the size of an array\n", + "x = np.array([1,2,3], dtype=np.complex128)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "x" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "array([1.+0.j, 2.+0.j, 3.+0.j])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "x.itemsize" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "16" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# indexing and Slicing NumPy Arrays in Python\n", + "np_list = np.array([(1,2,3), (4,5,6)])\n", + "np_list\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "array([[1, 2, 3],\n", + " [4, 5, 6]])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "print('First row: ', np_list[0])\n", + "print('Second row: ', np_list[1])\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "First row: [1 2 3]\n", + "Second row: [4 5 6]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "print('First column: ', np_list[:,0])\n", + "print('Second column: ', np_list[:,1])\n", + "print('Third column: ', np_list[:,2])\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "First column: [1 4]\n", + "Second column: [2 5]\n", + "Third column: [3 6]" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### NumPy Statistical Functions with Example\n", + "\n", + "NumPy has quite useful statistical functions for finding minimum, maximum, mean, median, percentile,standard deviation and variance, etc from the given elements in the array.\n", + "The functions are explained as follows โˆ’\n", + "Statistical function\n", + "Numpy is equipped with the robust statistical function as listed below\n", + "\n", + "- Numpy Functions\n", + " - Min np.min()\n", + " - Max np.max()\n", + " - Mean np.mean()\n", + " - Median np.median()\n", + " - Standard deviation np.std()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "np_normal_dis = np.random.normal(5, 0.5, 100)\n", + "np_normal_dis\n", + "## min, max, mean, median, sd\n", + "print('min: ', two_dimension_array.min())\n", + "print('max: ', two_dimension_array.max())\n", + "print('mean: ',two_dimension_array.mean())\n", + "# print('median: ', two_dimension_array.median())\n", + "print('sd: ', two_dimension_array.std())" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "min: 1\n", + "max: 55\n", + "mean: 14.777777777777779\n", + "sd: 18.913709183069525" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "print(two_dimension_array)\n", + "print('Column with minimum: ', np.amin(two_dimension_array,axis=0))\n", + "print('Column with maximum: ', np.amax(two_dimension_array,axis=0))\n", + "print('=== Row ==')\n", + "print('Row with minimum: ', np.amin(two_dimension_array,axis=1))\n", + "print('Row with maximum: ', np.amax(two_dimension_array,axis=1))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "[[ 1 2 3]\n", + " [ 4 55 44]\n", + " [ 7 8 9]]\n", + "Column with minimum: [1 2 3]\n", + "Column with maximum: [ 7 55 44]\n", + "=== Row ==\n", + "Row with minimum: [1 4 7]\n", + "Row with maximum: [ 3 55 9]" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### How to create repeating sequences?" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "a = [1,2,3]\n", + "\n", + "# Repeat whole of 'a' two times\n", + "print('Tile: ', np.tile(a, 2))\n", + "\n", + "# Repeat each element of 'a' two times\n", + "print('Repeat: ', np.repeat(a, 2))\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "Tile: [1 2 3 1 2 3]\n", + "Repeat: [1 1 2 2 3 3]" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### How to generate random numbers?" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# One random number between [0,1)\n", + "one_random_num = np.random.random()\n", + "one_random_in = np.random\n", + "print(one_random_num)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "0.4763968133790438" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Random numbers between [0,1) of shape 2,3\n", + "r = np.random.random(size=[2,3])\n", + "print(r)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "[[0.67018871 0.71699922 0.36490538]\n", + " [0.78086531 0.5779336 0.81444353]]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "print(np.random.choice(['a', 'e', 'i', 'o', 'u'], size=10))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "['i' 'u' 'e' 'o' 'a' 'i' 'e' 'u' 'o' 'i']" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "## Random numbers between [0, 1] of shape 2, 2\n", + "rand = np.random.rand(2,2)\n", + "rand" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "array([[0.66811333, 0.1139411 ],\n", + " [0.90955775, 0.14954203]])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "rand2 = np.random.randn(2,2)\n", + "rand2\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "array([[-0.84819546, -0.39626819],\n", + " [ 0.9172979 , 0.03661474]])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Random integers between [0, 10) of shape 2,5\n", + "rand_int = np.random.randint(0, 10, size=[5,3])\n", + "rand_int" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "array([[2, 7, 0],\n", + " [0, 2, 7],\n", + " [5, 9, 4],\n", + " [6, 0, 8],\n", + " [4, 6, 2]])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from scipy import stats\n", + "np_normal_dis = np.random.normal(5, 0.5, 1000)\n", + "np_normal_dis\n", + "## min, max, mean, median, sd\n", + "print('min: ', np.min(np_normal_dis))\n", + "print('max: ', np.max(np_normal_dis))\n", + "print('mean: ', np.mean(np_normal_dis))\n", + "print('median: ', np.median(np_normal_dis))\n", + "print('mode: ', stats.mode(np_normal_dis))\n", + "print('sd: ', np.std(np_normal_dis))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "min: 3.566493784430423\n", + "max: 6.823091905048957\n", + "mean: 5.034308251615374\n", + "median: 5.0317142506545505\n", + "mode: ModeResult(mode=array([3.56649378]), count=array([1]))\n", + "sd: 0.5050902240094916" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "plt.hist(np_normal_dis, color=\"grey\", bins=21)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "(array([ 3., 7., 11., 22., 41., 64., 72., 109., 117., 122., 117.,\n", + " 93., 94., 47., 36., 20., 15., 5., 3., 0., 2.]),\n", + " array([3.56649378, 3.72156989, 3.87664599, 4.03172209, 4.18679819,\n", + " 4.34187429, 4.49695039, 4.65202649, 4.80710259, 4.96217869,\n", + " 5.11725479, 5.2723309 , 5.427407 , 5.5824831 , 5.7375592 ,\n", + " 5.8926353 , 6.0477114 , 6.2027875 , 6.3578636 , 6.5129397 ,\n", + " 6.6680158 , 6.82309191]),\n", + " )" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "![png](numpy_files/numpy_108_1.png)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# numpy.dot(): Dot Product in Python using Numpy\n", + "# Dot Product\n", + "# Numpy is powerful library for matrices computation. For instance, you can compute the dot product with np.dot\n", + "\n", + "# Syntax\n", + "\n", + "# numpy.dot(x, y, out=None)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "## Linear algebra\n", + "### Dot product: product of two arrays\n", + "f = np.array([1,2])\n", + "g = np.array([4,5])\n", + "### 1*4+2*5\n", + "np.dot(f, g)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "14" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "## Linear algebra\n", + "### Dot product: product of two arrays\n", + "f = np.array([1,2,3])\n", + "g = np.array([4,5,3])\n", + "### 1*4+2*5 + 3*6\n", + "np.dot(f, g)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "23" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# NumPy Matrix Multiplication with np.matmul()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "### Matmul: matruc product of two arrays\n", + "h = [[1,2],[3,4]]\n", + "i = [[5,6],[7,8]]\n", + "### 1*5+2*7 = 19\n", + "np.matmul(h, i)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "array([[19, 22],\n", + " [43, 50]])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "## Determinant 2*2 matrix\n", + "### 5*8-7*6np.linalg.det(i)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "np.linalg.det(i)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "-1.999999999999999" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "Z = np.zeros((8,8))\n", + "Z[1::2,::2] = 1\n", + "Z[::2,1::2] = 1" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "Z" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "array([[0., 1., 0., 1., 0., 1., 0., 1.],\n", + " [1., 0., 1., 0., 1., 0., 1., 0.],\n", + " [0., 1., 0., 1., 0., 1., 0., 1.],\n", + " [1., 0., 1., 0., 1., 0., 1., 0.],\n", + " [0., 1., 0., 1., 0., 1., 0., 1.],\n", + " [1., 0., 1., 0., 1., 0., 1., 0.],\n", + " [0., 1., 0., 1., 0., 1., 0., 1.],\n", + " [1., 0., 1., 0., 1., 0., 1., 0.]])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "new_list = [ x + 2 for x in range(0, 11)]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "new_list" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "[2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "np_arr = np.array(range(0, 11))\n", + "np_arr + 2" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "array([ 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "x = np.array([1,2,3,4,5])\n", + "y = x * 2 + 5\n", + "y" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "array([ 7, 9, 11, 13, 15])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "plt.plot(x,y)\n", + "plt.xlabel('Temperature in oC')\n", + "plt.ylabel('Pressure in atm')\n", + "plt.title('Temperature vs Pressure')\n", + "plt.xticks(np.arange(0, 6, step=0.5))\n", + "plt.show()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "![png](numpy_files/numpy_122_0.png)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "x = np.random.normal(size=1000)\n", + "ax = sns.distplot(x);\n", + "ax.set(xlabel=\"x\", ylabel='y')\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "[Text(0, 0.5, 'y'), Text(0.5, 0, 'x')]" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "![png](numpy_files/numpy_123_1.png)\n", + "\n", + "# Summery\n", + "\n", + "To summarise, the main differences with python lists are:\n", + "\n", + "1. Arrays support vectorised operations, while lists donโ€™t.\n", + "1. Once an array is created, you cannot change its size. You will have to create a new array or overwrite the existing one.\n", + "1. Every array has one and only one dtype. All items in it should be of that dtype.\n", + "1. An equivalent numpy array occupies much less space than a python list of lists.\n", + "1. numpy arrays support boolean indexing.\n", + "\n", + "## ๐Ÿ’ป Exercises: Day 24\n", + "1. Repeat all the examples" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "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.7.4" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/readme22-24.md b/readme22-24.md index e891aa14..88f71904 100644 --- a/readme22-24.md +++ b/readme22-24.md @@ -24,25 +24,80 @@ - [Checking the available methods](#checking-the-available-methods) - [Creating python List](#creating-python-list) - [Checking data types](#checking-data-types) +- [](#) - [Creating Numpy(Numerical Python) array from python list](#creating-numpynumerical-python-array-from-python-list) +- [Python list](#python-list) - [We can always convert an array back to a python list using tolist().](#we-can-always-convert-an-array-back-to-a-python-list-using-tolist) - [Numpy array from tuple](#numpy-array-from-tuple) - [Creating tuple in Python](#creating-tuple-in-python) - [Mathematical Operation](#mathematical-operation) - [Addition](#addition) +- [Subtraction](#subtraction) - [Multiplication](#multiplication) -- [Converting type from float to int](#converting-type-from-float-to-int) -- [Converting type from int to str](#converting-type-from-int-to-str) +- [Division](#division) +- [Modulous; Finding the remainder](#modulous-finding-the-remainder) +- [Floor division: the division result without the remainder](#floor-division-the-division-result-without-the-remainder) +- [Exponential is finding some number the power of another:](#exponential-is-finding-some-number-the-power-of-another) - [2 Dimension Array](#2-dimension-array) - [2 Dimension Array](#2-dimension-array-1) - - [Reverse only the row positions](#reverse-only-the-row-positions) - - [Reverse the row and column positions](#reverse-the-row-and-column-positions) - - [How to represent missing values and infinite?](#how-to-represent-missing-values-and-infinite) - - [Generating Random Numbers](#generating-random-numbers) - - [Numpy and Statistics](#numpy-and-statistics) - - [NumPy Statistical Functions with Example](#numpy-statistical-functions-with-example) - - [How to create repeating sequences?](#how-to-create-repeating-sequences) - - [How to generate random numbers?](#how-to-generate-random-numbers) +- [Numpy Zeroes](#numpy-zeroes) +- [numpy.zeros(shape, dtype=float, order='C')](#numpyzerosshape-dtypefloat-orderc) +- [Numpy Zeroes](#numpy-zeroes-1) +- [Reshape](#reshape) +- [numpy.reshape(), numpy.flatten()](#numpyreshape-numpyflatten) + - [Horitzontal Stack](#horitzontal-stack) + - [Vertical Stack](#vertical-stack) +- [Generate a random float number](#generate-a-random-float-number) +- [Generate a random float number](#generate-a-random-float-number-1) +- [Generating a random integers between 0 and 10](#generating-a-random-integers-between-0-and-10) +- [Generating a random integers between 2 and 11, and creating a one row array](#generating-a-random-integers-between-2-and-11-and-creating-a-one-row-array) +- [Generating a random integers between 0 and 10](#generating-a-random-integers-between-0-and-10-1) +- [Generate random numbers](#generate-random-numbers) +- [np.random.normal(mu, sigma, size)](#nprandomnormalmu-sigma-size) +- [numpy.asarray()](#numpyasarray) +- [Asarray](#asarray) +- [The asarray()function is used when you want to convert an input to an array.](#the-asarrayfunction-is-used-when-you-want-to-convert-an-input-to-an-array) +- [The input could be a lists, tuple, ndarray, etc.](#the-input-could-be-a-lists-tuple-ndarray-etc) +- [numpy.arange() in Python with Example](#numpyarange-in-python-with-example) +- [Whay is Arrange?](#whay-is-arrange) +- [Sometimes, you want to create values that are evenly spaced within a defined interval.](#sometimes-you-want-to-create-values-that-are-evenly-spaced-within-a-defined-interval) +- [For instance, you want to create values from 1 to 10; you can use numpy.arange() function](#for-instance-you-want-to-create-values-from-1-to-10-you-can-use-numpyarange-function) +- [creating list using range(starting, stop, step)](#creating-list-using-rangestarting-stop-step) +- [Similar to range arange numpy.arange(start, stop, step)](#similar-to-range-arange-numpyarangestart-stop-step) +- [numpy.linspace()](#numpylinspace) +- [numpy.logspace() in Python with Example](#numpylogspace-in-python-with-example) +- [For instance, it can be used to create 10 values from 1 to 5 evenly spaced.](#for-instance-it-can-be-used-to-create-10-values-from-1-to-5-evenly-spaced) +- [not to include the last value in the interval](#not-to-include-the-last-value-in-the-interval) +- [LogSpace](#logspace) +- [LogSpace returns even spaced numbers on a log scale. Logspace has the same parameters as np.linspace.](#logspace-returns-even-spaced-numbers-on-a-log-scale-logspace-has-the-same-parameters-as-nplinspace) +- [Syntax:](#syntax) +- [numpy.logspace(start, stop, num, endpoint)](#numpylogspacestart-stop-num-endpoint) +- [to check the size of an array](#to-check-the-size-of-an-array) +- [indexing and Slicing NumPy Arrays in Python](#indexing-and-slicing-numpy-arrays-in-python) + - [min, max, mean, median, sd](#min-max-mean-median-sd) +- [print('median: ', two_dimension_array.median())](#printmedian--twodimensionarraymedian) +- [Repeat whole of 'a' two times](#repeat-whole-of-a-two-times) +- [Repeat each element of 'a' two times](#repeat-each-element-of-a-two-times) +- [One random number between [0,1)](#one-random-number-between-01) +- [Random numbers between [0,1) of shape 2,3](#random-numbers-between-01-of-shape-23) + - [Random numbers between [0, 1] of shape 2, 2](#random-numbers-between-0-1-of-shape-2-2) +- [Random integers between [0, 10) of shape 2,5](#random-integers-between-0-10-of-shape-25) + - [min, max, mean, median, sd](#min-max-mean-median-sd-1) +- [numpy.dot(): Dot Product in Python using Numpy](#numpydot-dot-product-in-python-using-numpy) +- [Dot Product](#dot-product) +- [Numpy is powerful library for matrices computation. For instance, you can compute the dot product with np.dot](#numpy-is-powerful-library-for-matrices-computation-for-instance-you-can-compute-the-dot-product-with-npdot) +- [Syntax](#syntax) +- [numpy.dot(x, y, out=None)](#numpydotx-y-outnone) + - [Linear algebra](#linear-algebra) + - [Dot product: product of two arrays](#dot-product-product-of-two-arrays) + - [14+25](#1425) + - [Linear algebra](#linear-algebra-1) + - [Dot product: product of two arrays](#dot-product-product-of-two-arrays-1) + - [14+25 + 3*6](#1425--36) + - [Matmul: matruc product of two arrays](#matmul-matruc-product-of-two-arrays) + - [15+27 = 19](#1527--19) + - [Determinant 2*2 matrix](#determinant-22-matrix) + - [58-76np.linalg.det(i)](#58-76nplinalgdeti) - [Summery](#summery) - [๐Ÿ’ป Exercises: Day 24](#%f0%9f%92%bb-exercises-day-24) @@ -190,27 +245,28 @@ The necessary modules to work on flask are installed. Now, you project directory ## ๐Ÿ’ป Exercises: Day 23 1. Create a project directory with a virtual environment based on the example give above. -# Day 24 +# ๐Ÿ“˜ Day 24 -## Python for Statistical Analysis +# Python for Statistical Analysis -### Statistics +## Statistics -Statistics is the discipline that concerns the _collection_, _organization_, _displaying_, _analysis_, _interpretation_ and _presentation_ of data. -Statistics is a sub field of mathematics that is universally agreed to be a prerequisite for a deeper understanding of data science and machine learning. Statistics is a very broad field but we will focus in this section only on the most relevant part. -After completing this challenge, you may go to web development, data analysis, machine learning and data science path. Whatever path you may follow, at some point you will in your career you will get data which you may work on. +Statistics is the discipline that studies the _collection_, _organization_, _displaying_, _analysis_, _interpretation_ and _presentation_ of data. +Statistics is a branch of mathematics that is recommended to be a prerequisite for data science and machine learning. Statistics is a very broad field but we will focus in this section only on the most relevant part. +After completing this challenge, you may go to web development, data analysis, machine learning and data science path. Whatever path you may follow, at some point in your career you will get data which you may work on. Having some statistical knowledge will help you to make decision based on data, *data tells as they say*. +## Data -### Data +What is data? Data is any set of characters that is gathered and translated for some purpose, usually analysis. It can be any character, including text and numbers, pictures, sound, or video. If data is not put into context, it doesn't give any sense to a human or computer. To make sense from data we need to work on the data using different tools. -What is data? Data is any set of characters that is gathered and translated for some purpose, usually analysis. It can be any character, including text and numbers, pictures, sound, or video. If data is not put into context, it doesn't do anything to a human or computer. To make sense from data we need to work on the data using different tools. -The work flow of data analysis, data science or machine learning starts from data. -Either we create or get data. Data can be found as small or big data format. Most of the data types we will get have been covered in the file handling section. +The work flow of data analysis, data science or machine learning starts from data. Data can be provided from some data source or it can be created. There are structured and and unstructure data. -### Statistics Module +Data can be found as small or big data format. Most of the data types we will get have been covered in the file handling section. + +## Statistics Module The python _statistics_ module provides functions for calculating mathematical statistics of numeric data. The module is not intended to be a competitor to third-party libraries such as NumPy, SciPy, or proprietary full-featured statistics packages aimed at professional statisticians such as Minitab, SAS and Matlab. It is aimed at the level of graphing and scientific calculators. -## NumPy +# NumPy In the first section we defined python as a great general-purpose programming language on its own, but with the help of other popular libraries (numpy, scipy, matplotlib, pandas etc) it becomes a powerful environment for scientific computing. @@ -218,15 +274,17 @@ Numpy is the core library for scientific computing in Python. It provides a high So far, we have been using vscode but from now on I would recommend using Jupyter Notebook. To access jupter notebook let's install [anaconda](https://www.anaconda.com/). If you are using anaconda most of the common packages are included and you don't have install packages if you installed anaconda. -```sh + +```python asabeneh@Asabeneh:~/Desktop/30DaysOfPython$ pip install numpy ``` -### Importing NumPy +## Importing NumPy Jupyter notebook is available if your are in favor of [jupyter notebook](https://github.com/Asabeneh/data-science-for-everyone/blob/master/numpy/numpy.ipynb) -```py + +```python # How to import numpy import numpy as np # How to check the version of the numpy package @@ -235,71 +293,73 @@ print('numpy:', np.__version__) print(dir(np)) ``` -### Creating numpy array using +## Creating numpy array using -```py +### Creating int numpy arrays + + +```python # Creating python List python_list = [1,2,3,4,5] + # Checking data types -print(type (python_list)) -print(python_list) +print('Type:', type (python_list)) # +# +print(python_list) # [1, 2, 3, 4, 5] + two_dimensional_list = [[0,1,2], [3,4,5], [6,7,8]] -print(two_dimensional_list) -``` -```sh - -[1 2 3 4 5] -``` +print(two_dimensional_list) # [[0, 1, 2], [3, 4, 5], [6, 7, 8]] -```py # Creating Numpy(Numerical Python) array from python list -numpy_array_from_list = np.array(python_list) -print(type (numpy_array_from_list)) -print(numpy_array_from_list) + +numpy_array_from_list = np.array(python_list) +print(type (numpy_array_from_list)) # +print(numpy_array_from_list) # array([1, 2, 3, 4, 5]) ``` -Creating list with a float data type +### Creating float numpy arrays +Creating a float numpy array from list with a float data type parameter -```py + +```python +# Python list python_list = [1,2,3,4,5] + numy_array_from_list2 = np.array(python_list, dtype=float) -print(numy_array_from_list2) +print(numy_array_from_list2) # array([1., 2., 3., 4., 5.]) ``` -```sh -array([1., 2., 3., 4., 5.]) -``` +### Creating boolean numpy arrays +Creating a boolean a numpy array from list -Creating list with a boolean data type -```py +```python numpy_bool_array = np.array([0, 1, -1, 0, 0], dtype=bool) -print(numpy_bool_array) +print(numpy_bool_array) # array([False, True, True, False, False]) ``` -```sh -array([False, True, True, False, False]) -``` +### Creating multidimensional array using numpy +A numpy array may have one or multiple rors and columns -Creating multidimensional array using numpy -```py +```python two_dimensional_list = [[0,1,2], [3,4,5], [6,7,8]] numpy_two_dimensional_list = np.array(two_dimensional_list) print(type (numpy_two_dimensional_list)) print(numpy_two_dimensional_list) ``` -```sh -array([[0, 1, 2], - [3, 4, 5], - [6, 7, 8]]) -``` + + [[0 1 2] + [3 4 5] + [6 7 8]] + ### Converting numpy array to list -```py + +```python # We can always convert an array back to a python list using tolist(). np_to_list = numpy_array_from_list.tolist() print(type (np_to_list)) @@ -307,39 +367,33 @@ print('one dimensional array:', np_to_list) print('two dimensional array: ', numpy_two_dimensional_list.tolist()) ``` -```sh - -one dimensional array: [1, 2, 3, 4, 5] -two dimensional array: [[0, 1, 2], [3, 4, 5], [6, 7, 8]] -``` + + one dimensional array: [1, 2, 3, 4, 5] + two dimensional array: [[0, 1, 2], [3, 4, 5], [6, 7, 8]] + ### Creating numpy array from tuple -```py + +```python # Numpy array from tuple # Creating tuple in Python python_tuple = (1,2,3,4,5) -print(type (python_tuple)) -print('python_tuple: ', python_tuple) +print(type (python_tuple)) # +print('python_tuple: ', python_tuple) # python_tuple: (1, 2, 3, 4, 5) numpy_array_from_tuple = np.array(python_tuple) -print(type (numpy_array_from_tuple)) -print('numpy_array_from_tuple: ', numpy_array_from_tuple) -``` - -```sh - -python_tuple: (1, 2, 3, 4, 5) - -numpy_array_from_tuple: array([1, 2, 3, 4, 5]) +print(type (numpy_array_from_tuple)) # +print('numpy_array_from_tuple: ', numpy_array_from_tuple) # numpy_array_from_tuple: [1 2 3 4 5] ``` ### Shape of numpy array -The shape method provide the shape of the array as a tuple. The first is the row and the second is the column +The shape method provide the shape of the array as a tuple. The first is the row and the second is the column. If the array is just one dimensional it returns the size of the array. -```py + +```python nums = np.array([1, 2, 3, 4, 5]) print(nums) print('shape of nums: ', nums.shape) @@ -351,21 +405,21 @@ three_by_four_array = np.array([[0, 1, 2, 3], print(three_by_four_array.shape) ``` -```sh -[1 2 3 4 5] -shape of nums: (5,) -[[0 1 2] -[3 4 5] -[6 7 8]] -shape of numpy_two_dimensional_list: (3, 3) -(3, 4) -``` + [1 2 3 4 5] + shape of nums: (5,) + [[0 1 2] + [3 4 5] + [6 7 8]] + shape of numpy_two_dimensional_list: (3, 3) + (3, 4) + ### Data type of numpy array Type of data types: str, int, float, complex, bool, list, None -```py + +```python int_lists = [-3, -2, -1, 0, 1, 2,3] int_array = np.array(int_lists) float_array = np.array(int_lists, dtype=float) @@ -376,93 +430,235 @@ print(float_array) print(float_array.dtype) ``` -```sh -[-3 -2 -1 0 1 2 3] -int64 -[-3. -2. -1. 0. 1. 2. 3.] -float64 -``` + [-3 -2 -1 0 1 2 3] + int64 + [-3. -2. -1. 0. 1. 2. 3.] + float64 -### Size of a numpy arrayยถ -Instead of len size is used to get the length of items in a numpy array +### Size of a numpy array +In numpy to know the number of items in a numpy array list we use size -```py + +```python numpy_array_from_list = np.array([1, 2, 3, 4, 5]) two_dimensional_list = np.array([[0, 1, 2], [3, 4, 5], [6, 7, 8]]) -print(len(numpy_array_from_list)) # 5 -print(len(two_dimensional_list)) # 3 + +print('The size:', numpy_array_from_list.size) # 5 +print('The size:', two_dimensional_list.size) # 3 + ``` -### Mathematical Operation + The size: 5 + The size: 9 -```py + +## Mathematical Operation using numpy + +Numpy array is not like exactly like python list. To do mathematical operation in pyhton list we have to loop through the items but numpy can allow to do any mathematical operation without looping. +Mathematical Operation: +* Addition (+) +* Subtraction (-) +* Multiplication (*) +* Division (/) +* Modules (%) +* Floor Division(//) +* Exponential(**) + + +### Addition + + +```python # Mathematical Operation # Addition +numpy_array_from_list = np.array([1, 2, 3, 4, 5]) print('original array: ', numpy_array_from_list) ten_plus_original = numpy_array_from_list + 10 print(ten_plus_original) + +``` + + original array: [1 2 3 4 5] + [11 12 13 14 15] + + +### Subtraction + + +```python +# Subtraction +numpy_array_from_list = np.array([1, 2, 3, 4, 5]) +print('original array: ', numpy_array_from_list) ten_minus_original = numpy_array_from_list - 10 print(ten_minus_original) + +``` + + original array: [1 2 3 4 5] + [-9 -8 -7 -6 -5] + + +### Multiplication + + +```python # Multiplication +numpy_array_from_list = np.array([1, 2, 3, 4, 5]) +print('original array: ', numpy_array_from_list) ten_times_original = numpy_array_from_list * 10 print(ten_times_original) ``` -```sh -original array: [1 2 3 4 5] -[11 12 13 14 15] -[-9 -8 -7 -6 -5] -[10 20 30 40 50] + original array: [1 2 3 4 5] + [10 20 30 40 50] + + +### Division + + +```python +# Division +numpy_array_from_list = np.array([1, 2, 3, 4, 5]) +print('original array: ', numpy_array_from_list) +ten_times_original = numpy_array_from_list / 10 +print(ten_times_original) ``` -### Checking numpy array data types + original array: [1 2 3 4 5] + [0.1 0.2 0.3 0.4 0.5] -```py -#Int, Float numbers -numpy_int_list = np.array([1,2,3,4]) -numpy_float_list = np.array([1.1, 2.0,3.2]) -numpy_float_list2 = np.array([1.1,2.0,3.2]) +### Modulous + -print(numpy_int_list.dtype) -print(numpy_float_list2.dtype) -print(numpy_float_list.dtype) +```python +# Modulous; Finding the remainder +numpy_array_from_list = np.array([1, 2, 3, 4, 5]) +print('original array: ', numpy_array_from_list) +ten_times_original = numpy_array_from_list % 3 +print(ten_times_original) ``` -```sh -int64 -float64 -float64 + original array: [1 2 3 4 5] + [1 2 0 1 2] + + +### Floor Division + + +```python +# Floor division: the division result without the remainder +numpy_array_from_list = np.array([1, 2, 3, 4, 5]) +print('original array: ', numpy_array_from_list) +ten_times_original = numpy_array_from_list // 10 +print(ten_times_original) +``` + +### Exponential + + +```python +# Exponential is finding some number the power of another: +numpy_array_from_list = np.array([1, 2, 3, 4, 5]) +print('original array: ', numpy_array_from_list) +ten_times_original = numpy_array_from_list ** 2 +print(ten_times_original) ``` + original array: [1 2 3 4 5] + [ 1 4 9 16 25] + + +## Checking data types + + +```python +#Int, Float numbers + +numpy_int_arr = np.array([1,2,3,4]) +numpy_float_arr = np.array([1.1, 2.0,3.2]) +numpy_bool_arr = np.array([-3, -2, 0, 1,2,3], dtype='bool') + +print(numpy_int_arr.dtype) +print(numpy_float_arr.dtype) +print(numpy_bool_arr.dtype) +``` + + int64 + float64 + bool + + ### Converting types -```py -# Converting type from float to int -numpy_float_list = np.array([1.1, 2.0,3.2]) -numpy_float_list.astype('int') -print(numpy_float_list) +We can convert the data types of numpy array +1. Int to Float + + +```python +numpy_int_arr = np.array([1,2,3,4], dtype = 'float') +numpy_int_arr ``` -```sh -array([1, 2, 3]) + + + + array([1., 2., 3., 4.]) + + + +2. Float to Int + + +```python +numpy_int_arr = np.array([1., 2., 3., 4.], dtype = 'int') +numpy_int_arr ``` -```py -# Converting type from int to str -numpy_float_list.astype('int').astype('str') + + + + array([1, 2, 3, 4]) + + + +3. Int ot boolean + + +```python +np.array([-3, -2, 0, 1,2,3], dtype='bool') + ``` -```sh -array(['1', '2', '3'], dtype=' -[[1 2 3] - [4 5 6] - [7 8 9]] -Shape: (3, 3) -Size: 9 -Data type: int64 -``` + + [[1 2 3] + [4 5 6] + [7 8 9]] + Shape: (3, 3) + Size: 9 + Data type: int64 + ### Getting items from a numpy array -```py + +```python # 2 Dimension Array two_dimension_array = np.array([[1,2,3],[4,5,6], [7,8,9]]) first_row = two_dimension_array[0] @@ -495,13 +691,13 @@ print('Second row:', second_row) print('Third row: ', third_row) ``` -```sh -First row: [1 2 3] -Second row: [4 5 6] -Third row: [7 8 9] -``` + First row: [1 2 3] + Second row: [4 5 6] + Third row: [7 8 9] -```py + + +```python first_column= two_dimension_array[:,0] second_column = two_dimension_array[:,1] third_column = two_dimension_array[:,2] @@ -512,59 +708,66 @@ print(two_dimension_array) ``` -```sh -First column: [1 4 7] -Second column: [2 5 8] -Third column: [3 6 9] -[[1 2 3] - [4 5 6] - [7 8 9]] -``` + First column: [1 4 7] + Second column: [2 5 8] + Third column: [3 6 9] + [[1 2 3] + [4 5 6] + [7 8 9]] + + +## Slicing Numpy array Slicing in numpy is similar to slicing in python list -```py + +```python +two_dimension_array = np.array([[1,2,3],[4,5,6], [7,8,9]]) first_two_rows_and_columns = two_dimension_array[0:2, 0:2] print(first_two_rows_and_columns) ``` -```sh -array([[1, 2], - [4, 5]]) -``` + [[1 2] + [4 5]] + ### How to reverse the rows and the whole array? -````python + +```python two_dimension_array[::] - array([[1, 2, 3], - [4, 5, 6], - [7, 8, 9]]) +``` -### Reverse only the row positions -```python -two_dimension_array[::-1,] -```` - array([[7, 8, 9], + array([[1, 2, 3], [4, 5, 6], - [1, 2, 3]]) + [7, 8, 9]]) + + ### Reverse the row and column positions + ```python +two_dimension_array = np.array([[1,2,3],[4,5,6], [7,8,9]]) two_dimension_array[::-1,::-1] ``` + + + array([[9, 8, 7], [6, 5, 4], [3, 2, 1]]) + + ## How to represent missing values and infinite? + ```python print(two_dimension_array) two_dimension_array[1,1] = 55 @@ -579,6 +782,8 @@ print(two_dimension_array) [ 4 55 44] [ 7 8 9]] + + ```python # Numpy Zeroes # numpy.zeros(shape, dtype=float, order='C') @@ -586,10 +791,16 @@ numpy_zeroes = np.zeros((3,3),dtype=int,order='C') numpy_zeroes ``` + + + array([[0, 0, 0], [0, 0, 0], [0, 0, 0]]) + + + ```python # Numpy Zeroes numpy_ones = np.ones((3,3),dtype=int,order='C') @@ -600,10 +811,13 @@ print(numpy_ones) [1 1 1] [1 1 1]] + + ```python twoes = numpy_ones * 2 ``` + ```python # Reshape # numpy.reshape(), numpy.flatten() @@ -620,13 +834,21 @@ print(reshaped) [3 4] [5 6]] + + ```python flattened = reshaped.flatten() flattened ``` + + + array([1, 2, 3, 4, 5, 6]) + + + ```python ## Horitzontal Stack np_list_one = np.array([1,2,3]) @@ -640,6 +862,8 @@ print('Horizontal Append:', np.hstack((np_list_one, np_list_two))) [5 7 9] Horizontal Append: [1 2 3 4 5 6] + + ```python ## Vertical Stack print('Vertical Append:', np.vstack((np_list_one, np_list_two))) @@ -648,23 +872,49 @@ print('Vertical Append:', np.vstack((np_list_one, np_list_two))) Vertical Append: [[1 2 3] [4 5 6]] + #### Generating Random Numbers + ```python # Generate a random float number random_float = np.random.random() random_float ``` + + + + 0.018929887384753874 + + + + +```python +0.6661632875670657 +``` + + + + 0.6661632875670657 + + + ```python # Generate a random float number random_floats = np.random.random(5) random_floats ``` - array([0.12945387, 0.1859908 , 0.47805876, 0.51996342, 0.52458233]) + + + + array([0.26392192, 0.35842215, 0.87908478, 0.41902195, 0.78926418]) + + + ```python # Generating a random integers between 0 and 10 @@ -672,15 +922,39 @@ random_int = np.random.randint(0, 11) random_int ``` + + + + 4 + + + + +```python +7 +``` + + + + 7 + + + ```python # Generating a random integers between 2 and 11, and creating a one row array random_int = np.random.randint(2,10, size=4) random_int ``` - array([5, 8, 8, 9]) + + + + array([8, 8, 8, 2]) + + + ```python # Generating a random integers between 0 and 10 @@ -688,9 +962,15 @@ random_int = np.random.randint(2,10, size=(3,3)) random_int ``` - array([[8, 9, 5], - [9, 8, 3], - [2, 3, 8]]) + + + + array([[3, 5, 3], + [7, 3, 6], + [2, 3, 3]]) + + + ```python # Generate random numbers @@ -700,31 +980,35 @@ normal_array ``` - array([ 76.67233671, 87.8686846 , 64.80771996, 79.44136527, - 68.83066184, 102.85967631, 74.40838573, 58.56053793, - 93.76814784, 82.16082568, 86.80548555, 77.95291907, - 97.71514434, 95.94083876, 82.53018033, 73.74619803, - 67.07970869, 102.20984782, 81.67766599, 73.82096132, - 90.17632538, 102.87342877, 84.19855251, 81.11888938, - 63.42782472, 75.3734846 , 79.04423914, 56.52607352, - 58.30505483, 54.69555571, 63.25792739, 88.75239018, - 85.44533248, 59.76883843, 39.72683784, 78.1029094 , - 54.19952262, 82.383277 , 87.01010766, 73.09642208, - 81.99276776, 82.58990091, 72.71303439, 101.73499367, - 73.65596295, 81.89611334, 96.14703307, 74.9629613 , - 84.79491744, 90.77830881, 70.69085365, 69.27799996, - 74.07836137, 56.79410721, 76.08072393, 83.28246182, - 83.66382654, 80.79644627, 83.39674788, 73.68044176, - 59.74405724, 47.50763054, 50.99870066, 85.53776901, - 80.61131428, 62.66726385, 69.8289171 , 58.2394869 , - 86.5158869 , 86.92976422, 65.12965299, 101.9918336 , - 73.3855881 , 99.29788439, 82.48238578, 83.14592314, - 109.13987986, 87.18461073, 73.18647475, 76.04712709, - - ]) + + + + array([ 89.49990595, 82.06056961, 107.21445842, 38.69307086, + 47.85259157, 93.07381061, 76.40724259, 78.55675184, + 72.17358173, 47.9888899 , 65.10370622, 76.29696568, + 95.58234254, 68.14897213, 38.75862686, 122.5587927 , + 67.0762565 , 95.73990864, 81.97454563, 92.54264805, + 59.37035153, 77.76828101, 52.30752166, 64.43109931, + 62.63695351, 90.04616138, 75.70009094, 49.87586877, + 80.22002414, 68.56708848, 76.27791052, 67.24343975, + 81.86363935, 78.22703433, 102.85737041, 65.15700341, + 84.87033426, 76.7569997 , 64.61321853, 67.37244562, + 74.4068773 , 58.65119655, 71.66488727, 53.42458179, + 70.26872028, 60.96588544, 83.56129414, 72.14255326, + 81.00787609, 71.81264853, 72.64168853, 86.56608717, + 94.94667321, 82.32676973, 70.5165446 , 85.43061003, + 72.45526212, 87.34681775, 87.69911217, 103.02831489, + 75.28598596, 67.17806893, 92.41274447, 101.06662611, + 87.70013935, 70.73980645, 46.40368207, 50.17947092, + 61.75618542, 90.26191397, 78.63968639, 70.84550744, + 88.91826581, 103.91474733, 66.3064638 , 79.49726264, + 70.81087439, 83.90130623, 87.58555972, 59.95462521]) + + ## Numpy and Statistics + ```python import matplotlib.pyplot as plt import seaborn as sns @@ -732,28 +1016,29 @@ sns.set() plt.hist(normal_array, color="grey", bins=50) ``` - (array([ 1., 0., 1., 2., 0., 1., 3., 3., 4., 2., 4., 10., 7., - 12., 15., 13., 20., 26., 16., 32., 36., 42., 38., 37., 35., 54., - 50., 40., 40., 55., 56., 49., 45., 29., 37., 26., 26., 23., 28., - 12., 22., 10., 11., 5., 3., 6., 4., 4., 3., 2.]), - array([ 26.42484343, 28.2913796 , 30.15791576, 32.02445192, - 33.89098809, 35.75752425, 37.62406041, 39.49059657, - 41.35713274, 43.2236689 , 45.09020506, 46.95674123, - 48.82327739, 50.68981355, 52.55634972, 54.42288588, - 56.28942204, 58.1559582 , 60.02249437, 61.88903053, - 63.75556669, 65.62210286, 67.48863902, 69.35517518, - 71.22171134, 73.08824751, 74.95478367, 76.82131983, - 78.687856 , 80.55439216, 82.42092832, 84.28746449, - 86.15400065, 88.02053681, 89.88707297, 91.75360914, - 93.6201453 , 95.48668146, 97.35321763, 99.21975379, - 101.08628995, 102.95282611, 104.81936228, 106.68589844, - 108.5524346 , 110.41897077, 112.28550693, 114.15204309, - 116.01857926, 117.88511542, 119.75165158]), + + + + (array([2., 0., 0., 0., 1., 2., 2., 0., 2., 0., 0., 1., 2., 2., 1., 4., 3., + 4., 2., 7., 2., 2., 5., 4., 2., 4., 3., 2., 1., 5., 3., 0., 3., 2., + 1., 0., 0., 1., 3., 0., 1., 0., 0., 0., 0., 0., 0., 0., 0., 1.]), + array([ 38.69307086, 40.37038529, 42.04769973, 43.72501417, + 45.4023286 , 47.07964304, 48.75695748, 50.43427191, + 52.11158635, 53.78890079, 55.46621523, 57.14352966, + 58.8208441 , 60.49815854, 62.17547297, 63.85278741, + 65.53010185, 67.20741628, 68.88473072, 70.56204516, + 72.23935959, 73.91667403, 75.59398847, 77.27130291, + 78.94861734, 80.62593178, 82.30324622, 83.98056065, + 85.65787509, 87.33518953, 89.01250396, 90.6898184 , + 92.36713284, 94.04444727, 95.72176171, 97.39907615, + 99.07639058, 100.75370502, 102.43101946, 104.1083339 , + 105.78564833, 107.46296277, 109.14027721, 110.81759164, + 112.49490608, 114.17222052, 115.84953495, 117.52684939, + 119.20416383, 120.88147826, 122.5587927 ]), ) -```python -``` + ```python # numpy.asarray() @@ -762,29 +1047,33 @@ plt.hist(normal_array, color="grey", bins=50) # The input could be a lists, tuple, ndarray, etc. ``` + ```python four_by_four_matrix = np.matrix(np.ones((4,4), dtype=float)) ``` + ```python four_by_four_matrix ``` - matrix([[1., 1., 1., 1.], +matrix([[1., 1., 1., 1.], [1., 1., 1., 1.], [1., 1., 1., 1.], [1., 1., 1., 1.]]) + ```python np.asarray(four_by_four_matrix)[2] = 2 four_by_four_matrix ``` - matrix([[1., 1., 1., 1.], +matrix([[1., 1., 1., 1.], [1., 1., 1., 1.], [2., 2., 2., 2.], [1., 1., 1., 1.]]) + ```python # numpy.arange() in Python with Example # Whay is Arrange? @@ -793,57 +1082,74 @@ four_by_four_matrix ``` + ```python # creating list using range(starting, stop, step) lst = range(0, 11, 2) lst ``` - range(0, 11, 2) + +```python +range(0, 11, 2) +``` + ```python for l in lst: print(l) ``` - 0 +0 2 4 6 8 10 + ```python # Similar to range arange numpy.arange(start, stop, step) whole_numbers = np.arange(0, 20, 1) whole_numbers ``` - array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, +array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]) + ```python natural_numbers = np.arange(1, 20, 1) natural_numbers ``` - array([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19]) ```python odd_numbers = np.arange(1, 20, 2) odd_numbers ``` + + + array([ 1, 3, 5, 7, 9, 11, 13, 15, 17, 19]) + + + ```python even_numbers = np.arange(2, 20, 2) even_numbers ``` + + + array([ 2, 4, 6, 8, 10, 12, 14, 16, 18]) + + + ```python # numpy.linspace() # numpy.logspace() in Python with Example @@ -851,16 +1157,28 @@ even_numbers np.linspace(1.0, 5.0, num=10) ``` + + + array([1. , 1.44444444, 1.88888889, 2.33333333, 2.77777778, 3.22222222, 3.66666667, 4.11111111, 4.55555556, 5. ]) + + + ```python # not to include the last value in the interval np.linspace(1.0, 5.0, num=5, endpoint=False) ``` + + + array([1. , 1.8, 2.6, 3.4, 4.2]) + + + ```python # LogSpace # LogSpace returns even spaced numbers on a log scale. Logspace has the same parameters as np.linspace. @@ -870,29 +1188,61 @@ np.linspace(1.0, 5.0, num=5, endpoint=False) # numpy.logspace(start, stop, num, endpoint) ``` + ```python np.logspace(2, 4.0, num=4) ``` + + + array([ 100. , 464.15888336, 2154.43469003, 10000. ]) + + + ```python # to check the size of an array x = np.array([1,2,3], dtype=np.complex128) ``` + ```python x ``` + + + array([1.+0.j, 2.+0.j, 3.+0.j]) + + + ```python x.itemsize ``` + + + + 16 + + + + +```python +16 +``` + + + + 16 + + + ```python # indexing and Slicing NumPy Arrays in Python np_list = np.array([(1,2,3), (4,5,6)]) @@ -900,9 +1250,15 @@ np_list ``` + + + array([[1, 2, 3], [4, 5, 6]]) + + + ```python print('First row: ', np_list[0]) print('Second row: ', np_list[1]) @@ -912,6 +1268,8 @@ print('Second row: ', np_list[1]) First row: [1 2 3] Second row: [4 5 6] + + ```python print('First column: ', np_list[:,0]) print('Second column: ', np_list[:,1]) @@ -923,9 +1281,10 @@ print('Third column: ', np_list[:,2]) Second column: [2 5] Third column: [3 6] + ### NumPy Statistical Functions with Example -NumPy has quite a few useful statistical functions for finding minimum, maximum, percentile standard deviation and variance, etc from the given elements in the array. +NumPy has quite useful statistical functions for finding minimum, maximum, mean, median, percentile,standard deviation and variance, etc from the given elements in the array. The functions are explained as follows โˆ’ Statistical function Numpy is equipped with the robust statistical function as listed below @@ -935,8 +1294,11 @@ Numpy is equipped with the robust statistical function as listed below - Max np.max() - Mean np.mean() - Median np.median() + - Varience + - Percentile - Standard deviation np.std() + ```python np_normal_dis = np.random.normal(5, 0.5, 100) np_normal_dis @@ -953,6 +1315,16 @@ print('sd: ', two_dimension_array.std()) mean: 14.777777777777779 sd: 18.913709183069525 + + +```python +min: 1 +max: 55 +mean: 14.777777777777779 +sd: 18.913709183069525 +``` + + ```python print(two_dimension_array) print('Column with minimum: ', np.amin(two_dimension_array,axis=0)) @@ -971,8 +1343,10 @@ print('Row with maximum: ', np.amax(two_dimension_array,axis=1)) Row with minimum: [1 4 7] Row with maximum: [ 3 55 9] + ### How to create repeating sequences? + ```python a = [1,2,3] @@ -987,8 +1361,10 @@ print('Repeat: ', np.repeat(a, 2)) Tile: [1 2 3 1 2 3] Repeat: [1 1 2 2 3 3] + ### How to generate random numbers? + ```python # One random number between [0,1) one_random_num = np.random.random() @@ -996,35 +1372,67 @@ one_random_in = np.random print(one_random_num) ``` + 0.6149403282678213 + + + +```python +0.4763968133790438 +``` + + + + 0.4763968133790438 + + + ```python # Random numbers between [0,1) of shape 2,3 r = np.random.random(size=[2,3]) print(r) ``` - [[0.67018871 0.71699922 0.36490538] - [0.78086531 0.5779336 0.81444353]] + [[0.13031737 0.4429537 0.1129527 ] + [0.76811539 0.88256594 0.6754075 ]] + + ```python print(np.random.choice(['a', 'e', 'i', 'o', 'u'], size=10)) ``` - ['i' 'u' 'e' 'o' 'a' 'i' 'e' 'u' 'o' 'i'] + ['u' 'o' 'o' 'i' 'e' 'e' 'u' 'o' 'u' 'a'] + -```python +```python +['i' 'u' 'e' 'o' 'a' 'i' 'e' 'u' 'o' 'i'] ``` + + + + ['iueoaieuoi'] + + + + ```python ## Random numbers between [0, 1] of shape 2, 2 rand = np.random.rand(2,2) rand ``` - array([[0.66811333, 0.1139411 ], - [0.90955775, 0.14954203]]) + + + + array([[0.97992598, 0.79642484], + [0.65263629, 0.55763145]]) + + + ```python rand2 = np.random.randn(2,2) @@ -1032,8 +1440,14 @@ rand2 ``` - array([[-0.84819546, -0.39626819], - [ 0.9172979 , 0.03661474]]) + + + + array([[ 1.65593322, -0.52326621], + [ 0.39071179, -2.03649407]]) + + + ```python # Random integers between [0, 10) of shape 2,5 @@ -1041,19 +1455,21 @@ rand_int = np.random.randint(0, 10, size=[5,3]) rand_int ``` - array([[2, 7, 0], - [0, 2, 7], - [5, 9, 4], - [6, 0, 8], - [4, 6, 2]]) -```python -``` + + array([[0, 7, 5], + [4, 1, 4], + [3, 5, 3], + [4, 3, 8], + [4, 6, 7]]) + + + ```python from scipy import stats -np_normal_dis = np.random.normal(5, 0.5, 1000) +np_normal_dis = np.random.normal(5, 0.5, 1000) # mean, standard deviation, number of samples np_normal_dis ## min, max, mean, median, sd print('min: ', np.min(np_normal_dis)) @@ -1064,27 +1480,24 @@ print('mode: ', stats.mode(np_normal_dis)) print('sd: ', np.std(np_normal_dis)) ``` - min: 3.566493784430423 - max: 6.823091905048957 - mean: 5.034308251615374 - median: 5.0317142506545505 - mode: ModeResult(mode=array([3.56649378]), count=array([1])) - sd: 0.5050902240094916 + min: 3.557811005458804 + max: 6.876317743643499 + mean: 5.035832048106663 + median: 5.020161980441937 + mode: ModeResult(mode=array([3.55781101]), count=array([1])) + sd: 0.489682424165213 + + ```python plt.hist(np_normal_dis, color="grey", bins=21) +plt.show() ``` - (array([ 3., 7., 11., 22., 41., 64., 72., 109., 117., 122., 117., - 93., 94., 47., 36., 20., 15., 5., 3., 0., 2.]), - array([3.56649378, 3.72156989, 3.87664599, 4.03172209, 4.18679819, - 4.34187429, 4.49695039, 4.65202649, 4.80710259, 4.96217869, - 5.11725479, 5.2723309 , 5.427407 , 5.5824831 , 5.7375592 , - 5.8926353 , 6.0477114 , 6.2027875 , 6.3578636 , 6.5129397 , - 6.6680158 , 6.82309191]), - ) -![png](numpy_files/numpy_108_1.png) +![png](test_files/test_121_0.png) + + ```python # numpy.dot(): Dot Product in Python using Numpy @@ -1096,6 +1509,7 @@ plt.hist(np_normal_dis, color="grey", bins=21) # numpy.dot(x, y, out=None) ``` + ```python ## Linear algebra ### Dot product: product of two arrays @@ -1105,8 +1519,29 @@ g = np.array([4,5]) np.dot(f, g) ``` + + + + 14 + + + + +```python +14 +``` + + + + 14 + + +### Linear Algebra +1. Dot Product + + ```python ## Linear algebra ### Dot product: product of two arrays @@ -1116,12 +1551,28 @@ g = np.array([4,5,3]) np.dot(f, g) ``` + + + 23 + + + ```python -# NumPy Matrix Multiplication with np.matmul() +23 ``` + + + + 23 + + + +### NumPy Matrix Multiplication with np.matmul() + + ```python ### Matmul: matruc product of two arrays h = [[1,2],[3,4]] @@ -1130,30 +1581,59 @@ i = [[5,6],[7,8]] np.matmul(h, i) ``` + + + array([[19, 22], [43, 50]]) + + + ```python ## Determinant 2*2 matrix ### 5*8-7*6np.linalg.det(i) ``` + ```python np.linalg.det(i) ``` + + + + -1.999999999999999 + + + + +```python +-1.999999999999999 +``` + + + + -1.999999999999999 + + + ```python Z = np.zeros((8,8)) Z[1::2,::2] = 1 Z[::2,1::2] = 1 ``` + ```python Z ``` + + + array([[0., 1., 0., 1., 0., 1., 0., 1.], [1., 0., 1., 0., 1., 0., 1., 0.], [0., 1., 0., 1., 0., 1., 0., 1.], @@ -1163,33 +1643,69 @@ Z [0., 1., 0., 1., 0., 1., 0., 1.], [1., 0., 1., 0., 1., 0., 1., 0.]]) + + + ```python new_list = [ x + 2 for x in range(0, 11)] ``` + ```python new_list ``` + + + + [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] + + + + +```python +[2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] +``` + + + + [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] + + + ```python np_arr = np.array(range(0, 11)) np_arr + 2 ``` + + + array([ 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]) + + +We use linear equation for quatities which have linear relationship. Let's see the example below: + + ```python -x = np.array([1,2,3,4,5]) -y = x * 2 + 5 -y +temp = np.array([1,2,3,4,5]) +pressure = temp * 2 + 5 +pressure ``` + + + array([ 7, 9, 11, 13, 15]) + + + ```python -plt.plot(x,y) +plt.plot(temp,pressure) plt.xlabel('Temperature in oC') plt.ylabel('Pressure in atm') plt.title('Temperature vs Pressure') @@ -1197,18 +1713,25 @@ plt.xticks(np.arange(0, 6, step=0.5)) plt.show() ``` -![png](numpy_files/numpy_122_0.png) + +![png](test_files/test_141_0.png) + + +To draw the Gaussian normal distribution using numpy. As you can see below, the numpy can generate random numbers. To create random sample, we need the mean(mu), sigma(standard deviation), mumber of data points. + ```python -x = np.random.normal(size=1000) +mu = 28 +sigma = 15 +samples = 100000 + +x = np.random.normal(mu, sigma, samples) ax = sns.distplot(x); ax.set(xlabel="x", ylabel='y') - +plt.show() ``` - [Text(0, 0.5, 'y'), Text(0.5, 0, 'x')] - -![png](numpy_files/numpy_123_1.png) +![png](test_files/test_143_0.png) # Summery @@ -1222,7 +1745,6 @@ To summarise, the main differences with python lists are: ## ๐Ÿ’ป Exercises: Day 24 1. Repeat all the examples - [<< Part 7 ](https://github.com/Asabeneh/30-Days-Of-Python/blob/master/readme19-21.md) | [Part 9 >>](https://github.com/Asabeneh/30-Days-Of-Python/blob/master/readme25-27.md) --- diff --git a/test.ipynb b/test.ipynb new file mode 100644 index 00000000..52204d10 --- /dev/null +++ b/test.ipynb @@ -0,0 +1,2606 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# ๐Ÿ“˜ Day 24\n", + "\n", + "# Python for Statistical Analysis\n", + "\n", + "## Statistics\n", + "\n", + "Statistics is the discipline that studies the _collection_, _organization_, _displaying_, _analysis_, _interpretation_ and _presentation_ of data.\n", + "Statistics is a branch of mathematics that is recommended to be a prerequisite for data science and machine learning. Statistics is a very broad field but we will focus in this section only on the most relevant part.\n", + "After completing this challenge, you may go to web development, data analysis, machine learning and data science path. Whatever path you may follow, at some point in your career you will get data which you may work on. Having some statistical knowledge will help you to make decision based on data, *data tells as they say*.\n", + "## Data\n", + "\n", + "What is data? Data is any set of characters that is gathered and translated for some purpose, usually analysis. It can be any character, including text and numbers, pictures, sound, or video. If data is not put into context, it doesn't give any sense to a human or computer. To make sense from data we need to work on the data using different tools.\n", + "\n", + "The work flow of data analysis, data science or machine learning starts from data. Data can be provided from some data source or it can be created. There are structured and and unstructure data. \n", + "\n", + "Data can be found as small or big data format. Most of the data types we will get have been covered in the file handling section.\n", + "\n", + "## Statistics Module\n", + "\n", + "The python _statistics_ module provides functions for calculating mathematical statistics of numeric data. The module is not intended to be a competitor to third-party libraries such as NumPy, SciPy, or proprietary full-featured statistics packages aimed at professional statisticians such as Minitab, SAS and Matlab. It is aimed at the level of graphing and scientific calculators.\n", + "\n", + "# NumPy\n", + "\n", + "In the first section we defined python as a great general-purpose programming language on its own, but with the help of other popular libraries (numpy, scipy, matplotlib, pandas etc) it becomes a powerful environment for scientific computing.\n", + "\n", + "Numpy is the core library for scientific computing in Python. It provides a high-performance multidimensional array object, and tools for working with arrays.\n", + "\n", + "So far, we have been using vscode but from now on I would recommend using Jupyter Notebook. To access jupter notebook let's install [anaconda](https://www.anaconda.com/). If you are using anaconda most of the common packages are included and you don't have install packages if you installed anaconda." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "asabeneh@Asabeneh:~/Desktop/30DaysOfPython$ pip install numpy" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Importing NumPy\n", + "\n", + "Jupyter notebook is available if your are in favor of [jupyter notebook](https://github.com/Asabeneh/data-science-for-everyone/blob/master/numpy/numpy.ipynb)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "attributes": { + "classes": [ + "py" + ], + "id": "" + } + }, + "outputs": [], + "source": [ + "# How to import numpy\n", + "import numpy as np\n", + "# How to check the version of the numpy package\n", + "print('numpy:', np.__version__)\n", + "# Checking the available methods\n", + "print(dir(np))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Creating numpy array using\n", + "\n", + "### Creating int numpy arrays" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "attributes": { + "classes": [ + "py" + ], + "id": "" + } + }, + "outputs": [], + "source": [ + "# Creating python List\n", + "python_list = [1,2,3,4,5]\n", + "\n", + "# Checking data types\n", + "print('Type:', type (python_list)) # \n", + "# \n", + "print(python_list) # [1, 2, 3, 4, 5]\n", + "\n", + "two_dimensional_list = [[0,1,2], [3,4,5], [6,7,8]]\n", + "\n", + "print(two_dimensional_list) # [[0, 1, 2], [3, 4, 5], [6, 7, 8]]\n", + "\n", + "# Creating Numpy(Numerical Python) array from python list\n", + "\n", + "numpy_array_from_list = np.array(python_list) \n", + "print(type (numpy_array_from_list)) # \n", + "print(numpy_array_from_list) # array([1, 2, 3, 4, 5])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Creating float numpy arrays\n", + "Creating a float numpy array from list with a float data type parameter" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "attributes": { + "classes": [ + "py" + ], + "id": "" + } + }, + "outputs": [], + "source": [ + "# Python list\n", + "python_list = [1,2,3,4,5]\n", + "\n", + "numy_array_from_list2 = np.array(python_list, dtype=float)\n", + "print(numy_array_from_list2) # array([1., 2., 3., 4., 5.])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Creating boolean numpy arrays\n", + "Creating a boolean a numpy array from list " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "attributes": { + "classes": [ + "py" + ], + "id": "" + } + }, + "outputs": [], + "source": [ + "numpy_bool_array = np.array([0, 1, -1, 0, 0], dtype=bool)\n", + "print(numpy_bool_array) # array([False, True, True, False, False])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Creating multidimensional array using numpy\n", + "A numpy array may have one or multiple rors and columns" + ] + }, + { + "cell_type": "code", + "execution_count": 152, + "metadata": { + "attributes": { + "classes": [ + "py" + ], + "id": "" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "[[0 1 2]\n", + " [3 4 5]\n", + " [6 7 8]]\n" + ] + } + ], + "source": [ + "two_dimensional_list = [[0,1,2], [3,4,5], [6,7,8]]\n", + "numpy_two_dimensional_list = np.array(two_dimensional_list)\n", + "print(type (numpy_two_dimensional_list))\n", + "print(numpy_two_dimensional_list)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Converting numpy array to list" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "attributes": { + "classes": [ + "py" + ], + "id": "" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "one dimensional array: [1, 2, 3, 4, 5]\n", + "two dimensional array: [[0, 1, 2], [3, 4, 5], [6, 7, 8]]\n" + ] + } + ], + "source": [ + "# We can always convert an array back to a python list using tolist().\n", + "np_to_list = numpy_array_from_list.tolist()\n", + "print(type (np_to_list))\n", + "print('one dimensional array:', np_to_list)\n", + "print('two dimensional array: ', numpy_two_dimensional_list.tolist())" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Creating numpy array from tuple" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "attributes": { + "classes": [ + "py" + ], + "id": "" + } + }, + "outputs": [], + "source": [ + "# Numpy array from tuple\n", + "# Creating tuple in Python\n", + "\n", + "python_tuple = (1,2,3,4,5)\n", + "print(type (python_tuple)) # \n", + "print('python_tuple: ', python_tuple) # python_tuple: (1, 2, 3, 4, 5)\n", + "\n", + "numpy_array_from_tuple = np.array(python_tuple)\n", + "print(type (numpy_array_from_tuple)) # \n", + "print('numpy_array_from_tuple: ', numpy_array_from_tuple) # numpy_array_from_tuple: [1 2 3 4 5]" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Shape of numpy array\n", + "\n", + "The shape method provide the shape of the array as a tuple. The first is the row and the second is the column. If the array is just one dimensional it returns the size of the array." + ] + }, + { + "cell_type": "code", + "execution_count": 153, + "metadata": { + "attributes": { + "classes": [ + "py" + ], + "id": "" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1 2 3 4 5]\n", + "shape of nums: (5,)\n", + "[[0 1 2]\n", + " [3 4 5]\n", + " [6 7 8]]\n", + "shape of numpy_two_dimensional_list: (3, 3)\n", + "(3, 4)\n" + ] + } + ], + "source": [ + "nums = np.array([1, 2, 3, 4, 5])\n", + "print(nums)\n", + "print('shape of nums: ', nums.shape)\n", + "print(numpy_two_dimensional_list)\n", + "print('shape of numpy_two_dimensional_list: ', numpy_two_dimensional_list.shape)\n", + "three_by_four_array = np.array([[0, 1, 2, 3],\n", + " [4,5,6,7],\n", + " [8,9,10, 11]])\n", + "print(three_by_four_array.shape)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Data type of numpy array\n", + "\n", + "Type of data types: str, int, float, complex, bool, list, None" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "attributes": { + "classes": [ + "py" + ], + "id": "" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[-3 -2 -1 0 1 2 3]\n", + "int64\n", + "[-3. -2. -1. 0. 1. 2. 3.]\n", + "float64\n" + ] + } + ], + "source": [ + "int_lists = [-3, -2, -1, 0, 1, 2,3]\n", + "int_array = np.array(int_lists)\n", + "float_array = np.array(int_lists, dtype=float)\n", + "\n", + "print(int_array)\n", + "print(int_array.dtype)\n", + "print(float_array)\n", + "print(float_array.dtype)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Size of a numpy array\n", + "In numpy to know the number of items in a numpy array list we use size" + ] + }, + { + "cell_type": "code", + "execution_count": 157, + "metadata": { + "attributes": { + "classes": [ + "py" + ], + "id": "" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The size: 5\n", + "The size: 9\n" + ] + } + ], + "source": [ + "numpy_array_from_list = np.array([1, 2, 3, 4, 5])\n", + "two_dimensional_list = np.array([[0, 1, 2],\n", + " [3, 4, 5],\n", + " [6, 7, 8]])\n", + "\n", + "print('The size:', numpy_array_from_list.size) # 5\n", + "print('The size:', two_dimensional_list.size) # 3\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Mathematical Operation using numpy\n", + "\n", + "Numpy array is not like exactly like python list. To do mathematical operation in pyhton list we have to loop through the items but numpy can allow to do any mathematical operation without looping.\n", + "Mathematical Operation:\n", + "* Addition (+)\n", + "* Subtraction (-)\n", + "* Multiplication (*)\n", + "* Division (/)\n", + "* Modules (%)\n", + "* Floor Division(//)\n", + "* Exponential(**)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Addition" + ] + }, + { + "cell_type": "code", + "execution_count": 165, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "original array: [1 2 3 4 5]\n", + "[11 12 13 14 15]\n" + ] + } + ], + "source": [ + "# Mathematical Operation\n", + "# Addition\n", + "numpy_array_from_list = np.array([1, 2, 3, 4, 5])\n", + "print('original array: ', numpy_array_from_list)\n", + "ten_plus_original = numpy_array_from_list + 10\n", + "print(ten_plus_original)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Subtraction" + ] + }, + { + "cell_type": "code", + "execution_count": 166, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "original array: [1 2 3 4 5]\n", + "[-9 -8 -7 -6 -5]\n" + ] + } + ], + "source": [ + "# Subtraction\n", + "numpy_array_from_list = np.array([1, 2, 3, 4, 5])\n", + "print('original array: ', numpy_array_from_list)\n", + "ten_minus_original = numpy_array_from_list - 10\n", + "print(ten_minus_original)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Multiplication" + ] + }, + { + "cell_type": "code", + "execution_count": 171, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "original array: [1 2 3 4 5]\n", + "[10 20 30 40 50]\n" + ] + } + ], + "source": [ + "# Multiplication\n", + "numpy_array_from_list = np.array([1, 2, 3, 4, 5])\n", + "print('original array: ', numpy_array_from_list)\n", + "ten_times_original = numpy_array_from_list * 10\n", + "print(ten_times_original)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Division" + ] + }, + { + "cell_type": "code", + "execution_count": 172, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "original array: [1 2 3 4 5]\n", + "[0.1 0.2 0.3 0.4 0.5]\n" + ] + } + ], + "source": [ + "# Division\n", + "numpy_array_from_list = np.array([1, 2, 3, 4, 5])\n", + "print('original array: ', numpy_array_from_list)\n", + "ten_times_original = numpy_array_from_list / 10\n", + "print(ten_times_original)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Modulous" + ] + }, + { + "cell_type": "code", + "execution_count": 173, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "original array: [1 2 3 4 5]\n", + "[1 2 0 1 2]\n" + ] + } + ], + "source": [ + "# Modulous; Finding the remainder\n", + "numpy_array_from_list = np.array([1, 2, 3, 4, 5])\n", + "print('original array: ', numpy_array_from_list)\n", + "ten_times_original = numpy_array_from_list % 3\n", + "print(ten_times_original)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Floor Division" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Floor division: the division result without the remainder\n", + "numpy_array_from_list = np.array([1, 2, 3, 4, 5])\n", + "print('original array: ', numpy_array_from_list)\n", + "ten_times_original = numpy_array_from_list // 10\n", + "print(ten_times_original)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Exponential" + ] + }, + { + "cell_type": "code", + "execution_count": 175, + "metadata": { + "attributes": { + "classes": [ + "py" + ], + "id": "" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "original array: [1 2 3 4 5]\n", + "[ 1 4 9 16 25]\n" + ] + } + ], + "source": [ + "# Exponential is finding some number the power of another:\n", + "numpy_array_from_list = np.array([1, 2, 3, 4, 5])\n", + "print('original array: ', numpy_array_from_list)\n", + "ten_times_original = numpy_array_from_list ** 2\n", + "print(ten_times_original)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Checking data types" + ] + }, + { + "cell_type": "code", + "execution_count": 181, + "metadata": { + "attributes": { + "classes": [ + "py" + ], + "id": "" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "int64\n", + "float64\n", + "bool\n" + ] + } + ], + "source": [ + "#Int, Float numbers\n", + "\n", + "numpy_int_arr = np.array([1,2,3,4])\n", + "numpy_float_arr = np.array([1.1, 2.0,3.2])\n", + "numpy_bool_arr = np.array([-3, -2, 0, 1,2,3], dtype='bool')\n", + "\n", + "print(numpy_int_arr.dtype)\n", + "print(numpy_float_arr.dtype)\n", + "print(numpy_bool_arr.dtype)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Converting types\n", + "\n", + "We can convert the data types of numpy array\n", + "1. Int to Float" + ] + }, + { + "cell_type": "code", + "execution_count": 184, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([1., 2., 3., 4.])" + ] + }, + "execution_count": 184, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "numpy_int_arr = np.array([1,2,3,4], dtype = 'float')\n", + "numpy_int_arr" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "2. Float to Int" + ] + }, + { + "cell_type": "code", + "execution_count": 185, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([1, 2, 3, 4])" + ] + }, + "execution_count": 185, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "numpy_int_arr = np.array([1., 2., 3., 4.], dtype = 'int')\n", + "numpy_int_arr" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "3. Int ot boolean" + ] + }, + { + "cell_type": "code", + "execution_count": 186, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([ True, True, False, True, True, True])" + ] + }, + "execution_count": 186, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "np.array([-3, -2, 0, 1,2,3], dtype='bool')\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "attributes": { + "classes": [ + "py" + ], + "id": "" + } + }, + "source": [ + "4. Int to str\n" + ] + }, + { + "cell_type": "code", + "execution_count": 190, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array(['1', '2', '3'], dtype='\n", + "[[1 2 3]\n", + " [4 5 6]\n", + " [7 8 9]]\n", + "Shape: (3, 3)\n", + "Size: 9\n", + "Data type: int64\n" + ] + } + ], + "source": [ + "# 2 Dimension Array\n", + "two_dimension_array = np.array([(1,2,3),(4,5,6), (7,8,9)])\n", + "print(type (two_dimension_array))\n", + "print(two_dimension_array)\n", + "print('Shape: ', two_dimension_array.shape)\n", + "print('Size:', two_dimension_array.size)\n", + "print('Data type:', two_dimension_array.dtype)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Getting items from a numpy array" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": { + "attributes": { + "classes": [ + "py" + ], + "id": "" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "First row: [1 2 3]\n", + "Second row: [4 5 6]\n", + "Third row: [7 8 9]\n" + ] + } + ], + "source": [ + "# 2 Dimension Array\n", + "two_dimension_array = np.array([[1,2,3],[4,5,6], [7,8,9]])\n", + "first_row = two_dimension_array[0]\n", + "second_row = two_dimension_array[1]\n", + "third_row = two_dimension_array[2]\n", + "print('First row:', first_row)\n", + "print('Second row:', second_row)\n", + "print('Third row: ', third_row)" + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "metadata": { + "attributes": { + "classes": [ + "py" + ], + "id": "" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "First column: [1 4 7]\n", + "Second column: [2 5 8]\n", + "Third column: [3 6 9]\n", + "[[1 2 3]\n", + " [4 5 6]\n", + " [7 8 9]]\n" + ] + } + ], + "source": [ + "first_column= two_dimension_array[:,0]\n", + "second_column = two_dimension_array[:,1]\n", + "third_column = two_dimension_array[:,2]\n", + "print('First column:', first_column)\n", + "print('Second column:', second_column)\n", + "print('Third column: ', third_column)\n", + "print(two_dimension_array)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Slicing Numpy array\n", + "\n", + "Slicing in numpy is similar to slicing in python list" + ] + }, + { + "cell_type": "code", + "execution_count": 193, + "metadata": { + "attributes": { + "classes": [ + "py" + ], + "id": "" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[[1 2]\n", + " [4 5]]\n" + ] + } + ], + "source": [ + "two_dimension_array = np.array([[1,2,3],[4,5,6], [7,8,9]])\n", + "first_two_rows_and_columns = two_dimension_array[0:2, 0:2]\n", + "print(first_two_rows_and_columns)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### How to reverse the rows and the whole array?" + ] + }, + { + "cell_type": "code", + "execution_count": 195, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([[1, 2, 3],\n", + " [4, 5, 6],\n", + " [7, 8, 9]])" + ] + }, + "execution_count": 195, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "two_dimension_array[::]\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Reverse the row and column positions" + ] + }, + { + "cell_type": "code", + "execution_count": 196, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([[9, 8, 7],\n", + " [6, 5, 4],\n", + " [3, 2, 1]])" + ] + }, + "execution_count": 196, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "two_dimension_array = np.array([[1,2,3],[4,5,6], [7,8,9]])\n", + "two_dimension_array[::-1,::-1]" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## How to represent missing values and infinite?" + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[[1 2 3]\n", + " [4 5 6]\n", + " [7 8 9]]\n", + "[[ 1 2 3]\n", + " [ 4 55 44]\n", + " [ 7 8 9]]\n" + ] + } + ], + "source": [ + "print(two_dimension_array)\n", + "two_dimension_array[1,1] = 55\n", + "two_dimension_array[1,2] =44\n", + "print(two_dimension_array)" + ] + }, + { + "cell_type": "code", + "execution_count": 44, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([[0, 0, 0],\n", + " [0, 0, 0],\n", + " [0, 0, 0]])" + ] + }, + "execution_count": 44, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Numpy Zeroes\n", + "# numpy.zeros(shape, dtype=float, order='C')\n", + "numpy_zeroes = np.zeros((3,3),dtype=int,order='C')\n", + "numpy_zeroes" + ] + }, + { + "cell_type": "code", + "execution_count": 46, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[[1 1 1]\n", + " [1 1 1]\n", + " [1 1 1]]\n" + ] + } + ], + "source": [ + "# Numpy Zeroes\n", + "numpy_ones = np.ones((3,3),dtype=int,order='C')\n", + "print(numpy_ones)" + ] + }, + { + "cell_type": "code", + "execution_count": 48, + "metadata": {}, + "outputs": [], + "source": [ + "twoes = numpy_ones * 2" + ] + }, + { + "cell_type": "code", + "execution_count": 49, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[[1 2 3]\n", + " [4 5 6]]\n", + "[[1 2]\n", + " [3 4]\n", + " [5 6]]\n" + ] + } + ], + "source": [ + "# Reshape\n", + "# numpy.reshape(), numpy.flatten()\n", + "first_shape = np.array([(1,2,3), (4,5,6)])\n", + "print(first_shape)\n", + "reshaped = first_shape.reshape(3,2)\n", + "print(reshaped)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 51, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([1, 2, 3, 4, 5, 6])" + ] + }, + "execution_count": 51, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "flattened = reshaped.flatten()\n", + "flattened" + ] + }, + { + "cell_type": "code", + "execution_count": 53, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[5 7 9]\n", + "Horizontal Append: [1 2 3 4 5 6]\n" + ] + } + ], + "source": [ + "## Horitzontal Stack\n", + "np_list_one = np.array([1,2,3])\n", + "np_list_two = np.array([4,5,6])\n", + "\n", + "print(np_list_one + np_list_two)\n", + "\n", + "print('Horizontal Append:', np.hstack((np_list_one, np_list_two)))" + ] + }, + { + "cell_type": "code", + "execution_count": 55, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Vertical Append: [[1 2 3]\n", + " [4 5 6]]\n" + ] + } + ], + "source": [ + "## Vertical Stack\n", + "print('Vertical Append:', np.vstack((np_list_one, np_list_two)))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Generating Random Numbers" + ] + }, + { + "cell_type": "code", + "execution_count": 57, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "0.018929887384753874" + ] + }, + "execution_count": 57, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Generate a random float number\n", + "random_float = np.random.random()\n", + "random_float" + ] + }, + { + "cell_type": "code", + "execution_count": 58, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "0.6661632875670657" + ] + }, + "execution_count": 58, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "0.6661632875670657" + ] + }, + { + "cell_type": "code", + "execution_count": 59, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([0.26392192, 0.35842215, 0.87908478, 0.41902195, 0.78926418])" + ] + }, + "execution_count": 59, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Generate a random float number\n", + "random_floats = np.random.random(5)\n", + "random_floats" + ] + }, + { + "cell_type": "code", + "execution_count": 61, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "4" + ] + }, + "execution_count": 61, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Generating a random integers between 0 and 10\n", + "random_int = np.random.randint(0, 11)\n", + "random_int" + ] + }, + { + "cell_type": "code", + "execution_count": 62, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "7" + ] + }, + "execution_count": 62, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "7" + ] + }, + { + "cell_type": "code", + "execution_count": 63, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([8, 8, 8, 2])" + ] + }, + "execution_count": 63, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Generating a random integers between 2 and 11, and creating a one row array\n", + "random_int = np.random.randint(2,10, size=4)\n", + "random_int" + ] + }, + { + "cell_type": "code", + "execution_count": 65, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([[3, 5, 3],\n", + " [7, 3, 6],\n", + " [2, 3, 3]])" + ] + }, + "execution_count": 65, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Generating a random integers between 0 and 10\n", + "random_int = np.random.randint(2,10, size=(3,3))\n", + "random_int" + ] + }, + { + "cell_type": "code", + "execution_count": 67, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([ 89.49990595, 82.06056961, 107.21445842, 38.69307086,\n", + " 47.85259157, 93.07381061, 76.40724259, 78.55675184,\n", + " 72.17358173, 47.9888899 , 65.10370622, 76.29696568,\n", + " 95.58234254, 68.14897213, 38.75862686, 122.5587927 ,\n", + " 67.0762565 , 95.73990864, 81.97454563, 92.54264805,\n", + " 59.37035153, 77.76828101, 52.30752166, 64.43109931,\n", + " 62.63695351, 90.04616138, 75.70009094, 49.87586877,\n", + " 80.22002414, 68.56708848, 76.27791052, 67.24343975,\n", + " 81.86363935, 78.22703433, 102.85737041, 65.15700341,\n", + " 84.87033426, 76.7569997 , 64.61321853, 67.37244562,\n", + " 74.4068773 , 58.65119655, 71.66488727, 53.42458179,\n", + " 70.26872028, 60.96588544, 83.56129414, 72.14255326,\n", + " 81.00787609, 71.81264853, 72.64168853, 86.56608717,\n", + " 94.94667321, 82.32676973, 70.5165446 , 85.43061003,\n", + " 72.45526212, 87.34681775, 87.69911217, 103.02831489,\n", + " 75.28598596, 67.17806893, 92.41274447, 101.06662611,\n", + " 87.70013935, 70.73980645, 46.40368207, 50.17947092,\n", + " 61.75618542, 90.26191397, 78.63968639, 70.84550744,\n", + " 88.91826581, 103.91474733, 66.3064638 , 79.49726264,\n", + " 70.81087439, 83.90130623, 87.58555972, 59.95462521])" + ] + }, + "execution_count": 67, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Generate random numbers\n", + "# np.random.normal(mu, sigma, size)\n", + "normal_array = np.random.normal(79, 15, 80)\n", + "normal_array\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Numpy and Statistics" + ] + }, + { + "cell_type": "code", + "execution_count": 69, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(array([2., 0., 0., 0., 1., 2., 2., 0., 2., 0., 0., 1., 2., 2., 1., 4., 3.,\n", + " 4., 2., 7., 2., 2., 5., 4., 2., 4., 3., 2., 1., 5., 3., 0., 3., 2.,\n", + " 1., 0., 0., 1., 3., 0., 1., 0., 0., 0., 0., 0., 0., 0., 0., 1.]),\n", + " array([ 38.69307086, 40.37038529, 42.04769973, 43.72501417,\n", + " 45.4023286 , 47.07964304, 48.75695748, 50.43427191,\n", + " 52.11158635, 53.78890079, 55.46621523, 57.14352966,\n", + " 58.8208441 , 60.49815854, 62.17547297, 63.85278741,\n", + " 65.53010185, 67.20741628, 68.88473072, 70.56204516,\n", + " 72.23935959, 73.91667403, 75.59398847, 77.27130291,\n", + " 78.94861734, 80.62593178, 82.30324622, 83.98056065,\n", + " 85.65787509, 87.33518953, 89.01250396, 90.6898184 ,\n", + " 92.36713284, 94.04444727, 95.72176171, 97.39907615,\n", + " 99.07639058, 100.75370502, 102.43101946, 104.1083339 ,\n", + " 105.78564833, 107.46296277, 109.14027721, 110.81759164,\n", + " 112.49490608, 114.17222052, 115.84953495, 117.52684939,\n", + " 119.20416383, 120.88147826, 122.5587927 ]),\n", + " )" + ] + }, + "execution_count": 69, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import matplotlib.pyplot as plt\n", + "import seaborn as sns\n", + "sns.set()\n", + "plt.hist(normal_array, color=\"grey\", bins=50)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# numpy.asarray()\n", + "# Asarray\n", + "# The asarray()function is used when you want to convert an input to an array.\n", + "# The input could be a lists, tuple, ndarray, etc." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "four_by_four_matrix = np.matrix(np.ones((4,4), dtype=float))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "four_by_four_matrix" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "matrix([[1., 1., 1., 1.],\n", + " [1., 1., 1., 1.],\n", + " [1., 1., 1., 1.],\n", + " [1., 1., 1., 1.]])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "np.asarray(four_by_four_matrix)[2] = 2\n", + "four_by_four_matrix" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "matrix([[1., 1., 1., 1.],\n", + " [1., 1., 1., 1.],\n", + " [2., 2., 2., 2.],\n", + " [1., 1., 1., 1.]])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# numpy.arange() in Python with Example\n", + "# Whay is Arrange?\n", + "# Sometimes, you want to create values that are evenly spaced within a defined interval.\n", + "# For instance, you want to create values from 1 to 10; you can use numpy.arange() function\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# creating list using range(starting, stop, step)\n", + "lst = range(0, 11, 2)\n", + "lst" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "range(0, 11, 2)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "for l in lst:\n", + " print(l)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "0\n", + " 2\n", + " 4\n", + " 6\n", + " 8\n", + " 10" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Similar to range arange numpy.arange(start, stop, step)\n", + "whole_numbers = np.arange(0, 20, 1)\n", + "whole_numbers" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,\n", + " 17, 18, 19])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "natural_numbers = np.arange(1, 20, 1)\n", + "natural_numbers" + ] + }, + { + "cell_type": "code", + "execution_count": 72, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([ 1, 3, 5, 7, 9, 11, 13, 15, 17, 19])" + ] + }, + "execution_count": 72, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "odd_numbers = np.arange(1, 20, 2)\n", + "odd_numbers" + ] + }, + { + "cell_type": "code", + "execution_count": 74, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([ 2, 4, 6, 8, 10, 12, 14, 16, 18])" + ] + }, + "execution_count": 74, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "even_numbers = np.arange(2, 20, 2)\n", + "even_numbers" + ] + }, + { + "cell_type": "code", + "execution_count": 76, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([1. , 1.44444444, 1.88888889, 2.33333333, 2.77777778,\n", + " 3.22222222, 3.66666667, 4.11111111, 4.55555556, 5. ])" + ] + }, + "execution_count": 76, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# numpy.linspace()\n", + "# numpy.logspace() in Python with Example\n", + "# For instance, it can be used to create 10 values from 1 to 5 evenly spaced.\n", + "np.linspace(1.0, 5.0, num=10)" + ] + }, + { + "cell_type": "code", + "execution_count": 78, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([1. , 1.8, 2.6, 3.4, 4.2])" + ] + }, + "execution_count": 78, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# not to include the last value in the interval\n", + "np.linspace(1.0, 5.0, num=5, endpoint=False)" + ] + }, + { + "cell_type": "code", + "execution_count": 80, + "metadata": {}, + "outputs": [], + "source": [ + "# LogSpace\n", + "# LogSpace returns even spaced numbers on a log scale. Logspace has the same parameters as np.linspace.\n", + "\n", + "# Syntax:\n", + "\n", + "# numpy.logspace(start, stop, num, endpoint)" + ] + }, + { + "cell_type": "code", + "execution_count": 81, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([ 100. , 464.15888336, 2154.43469003, 10000. ])" + ] + }, + "execution_count": 81, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "np.logspace(2, 4.0, num=4)" + ] + }, + { + "cell_type": "code", + "execution_count": 83, + "metadata": {}, + "outputs": [], + "source": [ + "# to check the size of an array\n", + "x = np.array([1,2,3], dtype=np.complex128)" + ] + }, + { + "cell_type": "code", + "execution_count": 84, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([1.+0.j, 2.+0.j, 3.+0.j])" + ] + }, + "execution_count": 84, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "x" + ] + }, + { + "cell_type": "code", + "execution_count": 86, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "16" + ] + }, + "execution_count": 86, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "x.itemsize" + ] + }, + { + "cell_type": "code", + "execution_count": 87, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "16" + ] + }, + "execution_count": 87, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "16" + ] + }, + { + "cell_type": "code", + "execution_count": 88, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([[1, 2, 3],\n", + " [4, 5, 6]])" + ] + }, + "execution_count": 88, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# indexing and Slicing NumPy Arrays in Python\n", + "np_list = np.array([(1,2,3), (4,5,6)])\n", + "np_list\n" + ] + }, + { + "cell_type": "code", + "execution_count": 90, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "First row: [1 2 3]\n", + "Second row: [4 5 6]\n" + ] + } + ], + "source": [ + "print('First row: ', np_list[0])\n", + "print('Second row: ', np_list[1])\n" + ] + }, + { + "cell_type": "code", + "execution_count": 92, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "First column: [1 4]\n", + "Second column: [2 5]\n", + "Third column: [3 6]\n" + ] + } + ], + "source": [ + "print('First column: ', np_list[:,0])\n", + "print('Second column: ', np_list[:,1])\n", + "print('Third column: ', np_list[:,2])\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### NumPy Statistical Functions with Example\n", + "\n", + "NumPy has quite useful statistical functions for finding minimum, maximum, mean, median, percentile,standard deviation and variance, etc from the given elements in the array.\n", + "The functions are explained as follows โˆ’\n", + "Statistical function\n", + "Numpy is equipped with the robust statistical function as listed below\n", + "\n", + "- Numpy Functions\n", + " - Min np.min()\n", + " - Max np.max()\n", + " - Mean np.mean()\n", + " - Median np.median()\n", + " - Varience\n", + " - Percentile\n", + " - Standard deviation np.std()" + ] + }, + { + "cell_type": "code", + "execution_count": 94, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "min: 1\n", + "max: 55\n", + "mean: 14.777777777777779\n", + "sd: 18.913709183069525\n" + ] + } + ], + "source": [ + "np_normal_dis = np.random.normal(5, 0.5, 100)\n", + "np_normal_dis\n", + "## min, max, mean, median, sd\n", + "print('min: ', two_dimension_array.min())\n", + "print('max: ', two_dimension_array.max())\n", + "print('mean: ',two_dimension_array.mean())\n", + "# print('median: ', two_dimension_array.median())\n", + "print('sd: ', two_dimension_array.std())" + ] + }, + { + "cell_type": "code", + "execution_count": 95, + "metadata": {}, + "outputs": [], + "source": [ + "min: 1\n", + "max: 55\n", + "mean: 14.777777777777779\n", + "sd: 18.913709183069525" + ] + }, + { + "cell_type": "code", + "execution_count": 96, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[[ 1 2 3]\n", + " [ 4 55 44]\n", + " [ 7 8 9]]\n", + "Column with minimum: [1 2 3]\n", + "Column with maximum: [ 7 55 44]\n", + "=== Row ==\n", + "Row with minimum: [1 4 7]\n", + "Row with maximum: [ 3 55 9]\n" + ] + } + ], + "source": [ + "print(two_dimension_array)\n", + "print('Column with minimum: ', np.amin(two_dimension_array,axis=0))\n", + "print('Column with maximum: ', np.amax(two_dimension_array,axis=0))\n", + "print('=== Row ==')\n", + "print('Row with minimum: ', np.amin(two_dimension_array,axis=1))\n", + "print('Row with maximum: ', np.amax(two_dimension_array,axis=1))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### How to create repeating sequences?" + ] + }, + { + "cell_type": "code", + "execution_count": 98, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Tile: [1 2 3 1 2 3]\n", + "Repeat: [1 1 2 2 3 3]\n" + ] + } + ], + "source": [ + "a = [1,2,3]\n", + "\n", + "# Repeat whole of 'a' two times\n", + "print('Tile: ', np.tile(a, 2))\n", + "\n", + "# Repeat each element of 'a' two times\n", + "print('Repeat: ', np.repeat(a, 2))\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### How to generate random numbers?" + ] + }, + { + "cell_type": "code", + "execution_count": 100, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.6149403282678213\n" + ] + } + ], + "source": [ + "# One random number between [0,1)\n", + "one_random_num = np.random.random()\n", + "one_random_in = np.random\n", + "print(one_random_num)" + ] + }, + { + "cell_type": "code", + "execution_count": 101, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "0.4763968133790438" + ] + }, + "execution_count": 101, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "0.4763968133790438" + ] + }, + { + "cell_type": "code", + "execution_count": 102, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[[0.13031737 0.4429537 0.1129527 ]\n", + " [0.76811539 0.88256594 0.6754075 ]]\n" + ] + } + ], + "source": [ + "# Random numbers between [0,1) of shape 2,3\n", + "r = np.random.random(size=[2,3])\n", + "print(r)" + ] + }, + { + "cell_type": "code", + "execution_count": 104, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['u' 'o' 'o' 'i' 'e' 'e' 'u' 'o' 'u' 'a']\n" + ] + } + ], + "source": [ + "print(np.random.choice(['a', 'e', 'i', 'o', 'u'], size=10))" + ] + }, + { + "cell_type": "code", + "execution_count": 105, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['iueoaieuoi']" + ] + }, + "execution_count": 105, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "['i' 'u' 'e' 'o' 'a' 'i' 'e' 'u' 'o' 'i']" + ] + }, + { + "cell_type": "code", + "execution_count": 106, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([[0.97992598, 0.79642484],\n", + " [0.65263629, 0.55763145]])" + ] + }, + "execution_count": 106, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "## Random numbers between [0, 1] of shape 2, 2\n", + "rand = np.random.rand(2,2)\n", + "rand" + ] + }, + { + "cell_type": "code", + "execution_count": 108, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([[ 1.65593322, -0.52326621],\n", + " [ 0.39071179, -2.03649407]])" + ] + }, + "execution_count": 108, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "rand2 = np.random.randn(2,2)\n", + "rand2\n" + ] + }, + { + "cell_type": "code", + "execution_count": 110, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([[0, 7, 5],\n", + " [4, 1, 4],\n", + " [3, 5, 3],\n", + " [4, 3, 8],\n", + " [4, 6, 7]])" + ] + }, + "execution_count": 110, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Random integers between [0, 10) of shape 2,5\n", + "rand_int = np.random.randint(0, 10, size=[5,3])\n", + "rand_int" + ] + }, + { + "cell_type": "code", + "execution_count": 112, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "min: 3.557811005458804\n", + "max: 6.876317743643499\n", + "mean: 5.035832048106663\n", + "median: 5.020161980441937\n", + "mode: ModeResult(mode=array([3.55781101]), count=array([1]))\n", + "sd: 0.489682424165213\n" + ] + } + ], + "source": [ + "from scipy import stats\n", + "np_normal_dis = np.random.normal(5, 0.5, 1000) # mean, standard deviation, number of samples\n", + "np_normal_dis\n", + "## min, max, mean, median, sd\n", + "print('min: ', np.min(np_normal_dis))\n", + "print('max: ', np.max(np_normal_dis))\n", + "print('mean: ', np.mean(np_normal_dis))\n", + "print('median: ', np.median(np_normal_dis))\n", + "print('mode: ', stats.mode(np_normal_dis))\n", + "print('sd: ', np.std(np_normal_dis))" + ] + }, + { + "cell_type": "code", + "execution_count": 198, + "metadata": {}, + "outputs": [ + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAD7CAYAAABpJS8eAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAATjklEQVR4nO3dfZBddX3H8fcuy0IkIWBcS5CCMjRfHS1Q5aFTfGpFHRyVMhZpoQi1gIxmSq0PrYKusWOrVMFBK1owptNMlSlUB3mYomBFRKi1go7It0yLDMha05SJCQrLsts/zlm4hs3ufdr7kN/7NZNJ7jm/e+43Z89+7u/+zrm/MzI3N4ckafc32u8CJEm9YeBLUiEMfEkqhIEvSYUw8CWpEGP9LqDBXsDRwBTweJ9rkaRhsQewFvg28OhiDQcp8I8GvtHvIiRpSL0EuGWxBoMU+FMADz30MLOzi383YM2alWzduqMnRXWTdffWMNY9jDWDdfdaY92joyPsv/8+UGfoYgYp8B8HmJ2dWzLw59sNI+vurWGsexhrBuvutQXqXnIo3JO2klQIA1+SCmHgS1IhDHxJKoSBL0mFMPAlqRAGviQVYpCuw5eesHr1XoyPj7f13OnpabZtW/Qb5lKRDHwNpPHxcTZs2NDWcycnJ1liShGpSA7pSFIhDHxJKoSBL0mFMPAlqRAGviQVwsCXpEIY+JJUCANfkgph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eq9qN2J/JbVUnVn5n9TvRnMr/8E8Cbgst5W+hRjVJ9QXw7sAK6mGgLcVK8fyP3NEnUPYpbs5C1U56F21vL+HtgefkQ8tz4hQWb+HPhnqt7l/PqDI+LNDU8Z4ckTYP1yCvCquhfxQeD1EXFxw/qfAqsjYn7e6rU0N7Hcclu07ohYHRFvb2g/AgzCibgX1+cd5u18DDxAtY/nNTuR37Jaqu6I+PWIeMOu1vfRT4CvZuaWzPwF8EWqYbN5A7m/WaLuAc0SACJinOoc1NULrG55fw9s4AOHApdFxF71f/pEfnk2zV8AF0bEc+qTYG+j+kH2TWa+MjNfkJlHAu8Hrs7Mtzesf4xqzv9T6kVvAvp6AhGWrpuqV/TuiDi2fryePu/r2n7A30TE3hGxiqrX1ljX7UBExGH1m+ypDMD+Zum6R4CPR8T+9XmfcxiM/X0N8OqI2K/enycA35lfmZn3AY9ExHH1otMZjP29aN0MYJY0OBz4z8zc+fxlW/t7YAM/M6+julrku1Q/nFvrK1uui4ijMnML1UedL1Nd3jgCfKxvBS8iIi6PiNfXD98KnBMRd1GNzQ7EZYILma87Mx8H3ghcGhE/pLp95bv7Wx1k5jX88jGyMTO/FRF3RMSBmfkIcCZwFdV5oLt58oR53zRR9/eAvwa+SVX3HYNwdVR92eiFVB2vu4D7gM/N/07WzU4DLo6Iu4GVwCV9KbbBUnUPeJYcStWTf0In+9vJ0ySpEAPbw5ckdZeBL0mFMPAlqRAGviQVwsCXpEIY+JJUCANfkgph4EtSIf4fAHzxT9SAhigAAAAASUVORK5CYII=\n", + "text/plain": [ + "
" + ] + }, + "metadata": { + "needs_background": "light" + }, + "output_type": "display_data" + } + ], + "source": [ + "plt.hist(np_normal_dis, color=\"grey\", bins=21)\n", + "plt.show()" + ] + }, + { + "cell_type": "code", + "execution_count": 116, + "metadata": {}, + "outputs": [], + "source": [ + "# numpy.dot(): Dot Product in Python using Numpy\n", + "# Dot Product\n", + "# Numpy is powerful library for matrices computation. For instance, you can compute the dot product with np.dot\n", + "\n", + "# Syntax\n", + "\n", + "# numpy.dot(x, y, out=None)" + ] + }, + { + "cell_type": "code", + "execution_count": 117, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "14" + ] + }, + "execution_count": 117, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "## Linear algebra\n", + "### Dot product: product of two arrays\n", + "f = np.array([1,2])\n", + "g = np.array([4,5])\n", + "### 1*4+2*5\n", + "np.dot(f, g)" + ] + }, + { + "cell_type": "code", + "execution_count": 204, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "14" + ] + }, + "execution_count": 204, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "14" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Linear Algebra\n", + "1. Dot Product" + ] + }, + { + "cell_type": "code", + "execution_count": 119, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "23" + ] + }, + "execution_count": 119, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "## Linear algebra\n", + "### Dot product: product of two arrays\n", + "f = np.array([1,2,3])\n", + "g = np.array([4,5,3])\n", + "### 1*4+2*5 + 3*6\n", + "np.dot(f, g)" + ] + }, + { + "cell_type": "code", + "execution_count": 120, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "23" + ] + }, + "execution_count": 120, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "23" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### NumPy Matrix Multiplication with np.matmul()" + ] + }, + { + "cell_type": "code", + "execution_count": 122, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([[19, 22],\n", + " [43, 50]])" + ] + }, + "execution_count": 122, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "### Matmul: matruc product of two arrays\n", + "h = [[1,2],[3,4]]\n", + "i = [[5,6],[7,8]]\n", + "### 1*5+2*7 = 19\n", + "np.matmul(h, i)" + ] + }, + { + "cell_type": "code", + "execution_count": 124, + "metadata": {}, + "outputs": [], + "source": [ + "## Determinant 2*2 matrix\n", + "### 5*8-7*6np.linalg.det(i)" + ] + }, + { + "cell_type": "code", + "execution_count": 125, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "-1.999999999999999" + ] + }, + "execution_count": 125, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "np.linalg.det(i)" + ] + }, + { + "cell_type": "code", + "execution_count": 126, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "-1.999999999999999" + ] + }, + "execution_count": 126, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "-1.999999999999999" + ] + }, + { + "cell_type": "code", + "execution_count": 127, + "metadata": {}, + "outputs": [], + "source": [ + "Z = np.zeros((8,8))\n", + "Z[1::2,::2] = 1\n", + "Z[::2,1::2] = 1" + ] + }, + { + "cell_type": "code", + "execution_count": 128, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([[0., 1., 0., 1., 0., 1., 0., 1.],\n", + " [1., 0., 1., 0., 1., 0., 1., 0.],\n", + " [0., 1., 0., 1., 0., 1., 0., 1.],\n", + " [1., 0., 1., 0., 1., 0., 1., 0.],\n", + " [0., 1., 0., 1., 0., 1., 0., 1.],\n", + " [1., 0., 1., 0., 1., 0., 1., 0.],\n", + " [0., 1., 0., 1., 0., 1., 0., 1.],\n", + " [1., 0., 1., 0., 1., 0., 1., 0.]])" + ] + }, + "execution_count": 128, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "Z" + ] + }, + { + "cell_type": "code", + "execution_count": 130, + "metadata": {}, + "outputs": [], + "source": [ + "new_list = [ x + 2 for x in range(0, 11)]" + ] + }, + { + "cell_type": "code", + "execution_count": 131, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]" + ] + }, + "execution_count": 131, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "new_list" + ] + }, + { + "cell_type": "code", + "execution_count": 132, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]" + ] + }, + "execution_count": 132, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "[2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]" + ] + }, + { + "cell_type": "code", + "execution_count": 209, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([ 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])" + ] + }, + "execution_count": 209, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "np_arr = np.array(range(0, 11))\n", + "np_arr + 2" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "We use linear equation for quatities which have linear relationship. Let's see the example below:" + ] + }, + { + "cell_type": "code", + "execution_count": 210, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([ 7, 9, 11, 13, 15])" + ] + }, + "execution_count": 210, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "temp = np.array([1,2,3,4,5])\n", + "pressure = temp * 2 + 5\n", + "pressure" + ] + }, + { + "cell_type": "code", + "execution_count": 211, + "metadata": {}, + "outputs": [ + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYgAAAEXCAYAAAC3c9OwAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO3dd3xV9f3H8VcS9sYQQVG2fNhb0Voq7oUDceKuoy5s62pr6692/zptRa2jrlZrawu4wIWKW1GGCevDkLBnWAkQSHLv749zYm/5heQm5I4k7+fjwYPcc885n8/33uR+7lmfkxGNRhEREdlXZqoTEBGR9KQCISIiFVKBEBGRCqlAiIhIhVQgRESkQioQIiJ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Oz8eRrBgd9e7h4l6Mz5QXiG0F3AHRbch+CicN0VjW0DwUHn+8zsC4LbbY5398p2L8XrEeA94LOwM+wAglbahAe0zwa+b8FtJ+cTdLg9090X1kJsqUd0mqvUa+G3+N/F7qYSkfhoC0JERCqkLQgREamQtiBERKRCKhAiIlIhFQgREamQCoSIiFRIBUJERCqkAiEiIhX6P/dwbz62La+gAAAAAElFTkSuQmCC\n", + "text/plain": [ + "
" + ] + }, + "metadata": { + "needs_background": "light" + }, + "output_type": "display_data" + } + ], + "source": [ + "plt.plot(temp,pressure)\n", + "plt.xlabel('Temperature in oC')\n", + "plt.ylabel('Pressure in atm')\n", + "plt.title('Temperature vs Pressure')\n", + "plt.xticks(np.arange(0, 6, step=0.5))\n", + "plt.show()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "To draw the Gaussian normal distribution using numpy. As you can see below, the numpy can generate random numbers. To create random sample, we need the mean(mu), sigma(standard deviation), mumber of data points." + ] + }, + { + "cell_type": "code", + "execution_count": 208, + "metadata": {}, + "outputs": [ + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZAAAAEJCAYAAAC61nFHAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO3deXRc1Z3g8e8rVZW2Ku2lXZb36wVjAzabIaSBJk1IQtIJYQYmZBlgOJ2cmczpzMzJCZnOzCRpTk/3QJNJOjNNeuhu46QbQjJ0YhiaQFjCYoNtyYt8bVmWrM3a15JUqm3+qCcjy5JVkuvp1fL7nOOk6r5XTz89qvSrd9+9v2tEo1GEEEKIpXLYHYAQQojUJAlECCHEskgCEUIIsSySQIQQQiyLJBAhhBDL4rQ7gBWSDewCuoGwzbEIIUSqyAKqgANAYO7GTEkgu4A37Q5CCCFS1M3AW3MbMy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iOHjgNtxJa2/hJJdm611i8TG3jyAbGBKS7gMZL03AJoradY+FxeVtxSTFEIIcSyyBWIEEKIZZEEIoQQYlkkgQghhFgWSSBCCCGWRRKIEEKIZZEEIoQQYlkkgQghhFgWKWUihE2UUl8kNlN8O7FSI+8Df6q1/jtbAxMiTjKRUAgbKaWeIVaULxsIa60ftjkkIeImVyBC2OsRYvWVJoFrbI5FiCWReyBC2KuCWI2tImLrMwiRMqQLSwibmKtAvk1s8ScH8CCwOwkqIwsRF7kCEcI+3wd6zGUC/jfQT2wZWiFSglyBCCGEWBa5AhFCCLEskkCEEEIsiyQQIYQQyyIJRAghxLJIAhFCCLEskkCEEEIsiyQQIYQQyyIJRAghxLL8f85qRJo53RIAAAAAAElFTkSuQmCC\n", + "text/plain": [ + "
" + ] + }, + "metadata": { + "needs_background": "light" + }, + "output_type": "display_data" + } + ], + "source": [ + "mu = 28\n", + "sigma = 15\n", + "samples = 100000\n", + "\n", + "x = np.random.normal(mu, sigma, samples)\n", + "ax = sns.distplot(x);\n", + "ax.set(xlabel=\"x\", ylabel='y')\n", + "plt.show()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "\n", + "\n", + "# Summery\n", + "\n", + "To summarise, the main differences with python lists are:\n", + "\n", + "1. Arrays support vectorised operations, while lists donโ€™t.\n", + "1. Once an array is created, you cannot change its size. You will have to create a new array or overwrite the existing one.\n", + "1. Every array has one and only one dtype. All items in it should be of that dtype.\n", + "1. An equivalent numpy array occupies much less space than a python list of lists.\n", + "1. numpy arrays support boolean indexing.\n", + "\n", + "## ๐Ÿ’ป Exercises: Day 24\n", + "1. Repeat all the examples" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "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.7.4" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/test.md b/test.md new file mode 100644 index 00000000..a7d9cb6a --- /dev/null +++ b/test.md @@ -0,0 +1,1504 @@ +# ๐Ÿ“˜ Day 24 + +# Python for Statistical Analysis + +## Statistics + +Statistics is the discipline that studies the _collection_, _organization_, _displaying_, _analysis_, _interpretation_ and _presentation_ of data. +Statistics is a branch of mathematics that is recommended to be a prerequisite for data science and machine learning. Statistics is a very broad field but we will focus in this section only on the most relevant part. +After completing this challenge, you may go to web development, data analysis, machine learning and data science path. Whatever path you may follow, at some point in your career you will get data which you may work on. Having some statistical knowledge will help you to make decision based on data, *data tells as they say*. +## Data + +What is data? Data is any set of characters that is gathered and translated for some purpose, usually analysis. It can be any character, including text and numbers, pictures, sound, or video. If data is not put into context, it doesn't give any sense to a human or computer. To make sense from data we need to work on the data using different tools. + +The work flow of data analysis, data science or machine learning starts from data. Data can be provided from some data source or it can be created. There are structured and and unstructure data. + +Data can be found as small or big data format. Most of the data types we will get have been covered in the file handling section. + +## Statistics Module + +The python _statistics_ module provides functions for calculating mathematical statistics of numeric data. The module is not intended to be a competitor to third-party libraries such as NumPy, SciPy, or proprietary full-featured statistics packages aimed at professional statisticians such as Minitab, SAS and Matlab. It is aimed at the level of graphing and scientific calculators. + +# NumPy + +In the first section we defined python as a great general-purpose programming language on its own, but with the help of other popular libraries (numpy, scipy, matplotlib, pandas etc) it becomes a powerful environment for scientific computing. + +Numpy is the core library for scientific computing in Python. It provides a high-performance multidimensional array object, and tools for working with arrays. + +So far, we have been using vscode but from now on I would recommend using Jupyter Notebook. To access jupter notebook let's install [anaconda](https://www.anaconda.com/). If you are using anaconda most of the common packages are included and you don't have install packages if you installed anaconda. + + +```python +asabeneh@Asabeneh:~/Desktop/30DaysOfPython$ pip install numpy +``` + +## Importing NumPy + +Jupyter notebook is available if your are in favor of [jupyter notebook](https://github.com/Asabeneh/data-science-for-everyone/blob/master/numpy/numpy.ipynb) + + +```python +# How to import numpy +import numpy as np +# How to check the version of the numpy package +print('numpy:', np.__version__) +# Checking the available methods +print(dir(np)) +``` + +## Creating numpy array using + +### Creating int numpy arrays + + +```python +# Creating python List +python_list = [1,2,3,4,5] + +# Checking data types +print('Type:', type (python_list)) # +# +print(python_list) # [1, 2, 3, 4, 5] + +two_dimensional_list = [[0,1,2], [3,4,5], [6,7,8]] + +print(two_dimensional_list) # [[0, 1, 2], [3, 4, 5], [6, 7, 8]] + +# Creating Numpy(Numerical Python) array from python list + +numpy_array_from_list = np.array(python_list) +print(type (numpy_array_from_list)) # +print(numpy_array_from_list) # array([1, 2, 3, 4, 5]) +``` + +### Creating float numpy arrays +Creating a float numpy array from list with a float data type parameter + + +```python +# Python list +python_list = [1,2,3,4,5] + +numy_array_from_list2 = np.array(python_list, dtype=float) +print(numy_array_from_list2) # array([1., 2., 3., 4., 5.]) +``` + +### Creating boolean numpy arrays +Creating a boolean a numpy array from list + + +```python +numpy_bool_array = np.array([0, 1, -1, 0, 0], dtype=bool) +print(numpy_bool_array) # array([False, True, True, False, False]) +``` + +### Creating multidimensional array using numpy +A numpy array may have one or multiple rors and columns + + +```python +two_dimensional_list = [[0,1,2], [3,4,5], [6,7,8]] +numpy_two_dimensional_list = np.array(two_dimensional_list) +print(type (numpy_two_dimensional_list)) +print(numpy_two_dimensional_list) +``` + + + [[0 1 2] + [3 4 5] + [6 7 8]] + + +### Converting numpy array to list + + +```python +# We can always convert an array back to a python list using tolist(). +np_to_list = numpy_array_from_list.tolist() +print(type (np_to_list)) +print('one dimensional array:', np_to_list) +print('two dimensional array: ', numpy_two_dimensional_list.tolist()) +``` + + + one dimensional array: [1, 2, 3, 4, 5] + two dimensional array: [[0, 1, 2], [3, 4, 5], [6, 7, 8]] + + +### Creating numpy array from tuple + + +```python +# Numpy array from tuple +# Creating tuple in Python + +python_tuple = (1,2,3,4,5) +print(type (python_tuple)) # +print('python_tuple: ', python_tuple) # python_tuple: (1, 2, 3, 4, 5) + +numpy_array_from_tuple = np.array(python_tuple) +print(type (numpy_array_from_tuple)) # +print('numpy_array_from_tuple: ', numpy_array_from_tuple) # numpy_array_from_tuple: [1 2 3 4 5] +``` + +### Shape of numpy array + +The shape method provide the shape of the array as a tuple. The first is the row and the second is the column. If the array is just one dimensional it returns the size of the array. + + +```python +nums = np.array([1, 2, 3, 4, 5]) +print(nums) +print('shape of nums: ', nums.shape) +print(numpy_two_dimensional_list) +print('shape of numpy_two_dimensional_list: ', numpy_two_dimensional_list.shape) +three_by_four_array = np.array([[0, 1, 2, 3], + [4,5,6,7], + [8,9,10, 11]]) +print(three_by_four_array.shape) +``` + + [1 2 3 4 5] + shape of nums: (5,) + [[0 1 2] + [3 4 5] + [6 7 8]] + shape of numpy_two_dimensional_list: (3, 3) + (3, 4) + + +### Data type of numpy array + +Type of data types: str, int, float, complex, bool, list, None + + +```python +int_lists = [-3, -2, -1, 0, 1, 2,3] +int_array = np.array(int_lists) +float_array = np.array(int_lists, dtype=float) + +print(int_array) +print(int_array.dtype) +print(float_array) +print(float_array.dtype) +``` + + [-3 -2 -1 0 1 2 3] + int64 + [-3. -2. -1. 0. 1. 2. 3.] + float64 + + +### Size of a numpy array +In numpy to know the number of items in a numpy array list we use size + + +```python +numpy_array_from_list = np.array([1, 2, 3, 4, 5]) +two_dimensional_list = np.array([[0, 1, 2], + [3, 4, 5], + [6, 7, 8]]) + +print('The size:', numpy_array_from_list.size) # 5 +print('The size:', two_dimensional_list.size) # 3 + +``` + + The size: 5 + The size: 9 + + +## Mathematical Operation using numpy + +Numpy array is not like exactly like python list. To do mathematical operation in pyhton list we have to loop through the items but numpy can allow to do any mathematical operation without looping. +Mathematical Operation: +* Addition (+) +* Subtraction (-) +* Multiplication (*) +* Division (/) +* Modules (%) +* Floor Division(//) +* Exponential(**) + + +### Addition + + +```python +# Mathematical Operation +# Addition +numpy_array_from_list = np.array([1, 2, 3, 4, 5]) +print('original array: ', numpy_array_from_list) +ten_plus_original = numpy_array_from_list + 10 +print(ten_plus_original) + +``` + + original array: [1 2 3 4 5] + [11 12 13 14 15] + + +### Subtraction + + +```python +# Subtraction +numpy_array_from_list = np.array([1, 2, 3, 4, 5]) +print('original array: ', numpy_array_from_list) +ten_minus_original = numpy_array_from_list - 10 +print(ten_minus_original) + +``` + + original array: [1 2 3 4 5] + [-9 -8 -7 -6 -5] + + +### Multiplication + + +```python +# Multiplication +numpy_array_from_list = np.array([1, 2, 3, 4, 5]) +print('original array: ', numpy_array_from_list) +ten_times_original = numpy_array_from_list * 10 +print(ten_times_original) +``` + + original array: [1 2 3 4 5] + [10 20 30 40 50] + + +### Division + + +```python +# Division +numpy_array_from_list = np.array([1, 2, 3, 4, 5]) +print('original array: ', numpy_array_from_list) +ten_times_original = numpy_array_from_list / 10 +print(ten_times_original) +``` + + original array: [1 2 3 4 5] + [0.1 0.2 0.3 0.4 0.5] + + +### Modulous + + +```python +# Modulous; Finding the remainder +numpy_array_from_list = np.array([1, 2, 3, 4, 5]) +print('original array: ', numpy_array_from_list) +ten_times_original = numpy_array_from_list % 3 +print(ten_times_original) +``` + + original array: [1 2 3 4 5] + [1 2 0 1 2] + + +### Floor Division + + +```python +# Floor division: the division result without the remainder +numpy_array_from_list = np.array([1, 2, 3, 4, 5]) +print('original array: ', numpy_array_from_list) +ten_times_original = numpy_array_from_list // 10 +print(ten_times_original) +``` + +### Exponential + + +```python +# Exponential is finding some number the power of another: +numpy_array_from_list = np.array([1, 2, 3, 4, 5]) +print('original array: ', numpy_array_from_list) +ten_times_original = numpy_array_from_list ** 2 +print(ten_times_original) +``` + + original array: [1 2 3 4 5] + [ 1 4 9 16 25] + + +## Checking data types + + +```python +#Int, Float numbers + +numpy_int_arr = np.array([1,2,3,4]) +numpy_float_arr = np.array([1.1, 2.0,3.2]) +numpy_bool_arr = np.array([-3, -2, 0, 1,2,3], dtype='bool') + +print(numpy_int_arr.dtype) +print(numpy_float_arr.dtype) +print(numpy_bool_arr.dtype) +``` + + int64 + float64 + bool + + +### Converting types + +We can convert the data types of numpy array +1. Int to Float + + +```python +numpy_int_arr = np.array([1,2,3,4], dtype = 'float') +numpy_int_arr +``` + + + + + array([1., 2., 3., 4.]) + + + +2. Float to Int + + +```python +numpy_int_arr = np.array([1., 2., 3., 4.], dtype = 'int') +numpy_int_arr +``` + + + + + array([1, 2, 3, 4]) + + + +3. Int ot boolean + + +```python +np.array([-3, -2, 0, 1,2,3], dtype='bool') + +``` + + + + + array([ True, True, False, True, True, True]) + + + +4. Int to str + + + +```python +numpy_float_list.astype('int').astype('str') +``` + + + + + array(['1', '2', '3'], dtype=' + [[1 2 3] + [4 5 6] + [7 8 9]] + Shape: (3, 3) + Size: 9 + Data type: int64 + + +### Getting items from a numpy array + + +```python +# 2 Dimension Array +two_dimension_array = np.array([[1,2,3],[4,5,6], [7,8,9]]) +first_row = two_dimension_array[0] +second_row = two_dimension_array[1] +third_row = two_dimension_array[2] +print('First row:', first_row) +print('Second row:', second_row) +print('Third row: ', third_row) +``` + + First row: [1 2 3] + Second row: [4 5 6] + Third row: [7 8 9] + + + +```python +first_column= two_dimension_array[:,0] +second_column = two_dimension_array[:,1] +third_column = two_dimension_array[:,2] +print('First column:', first_column) +print('Second column:', second_column) +print('Third column: ', third_column) +print(two_dimension_array) + +``` + + First column: [1 4 7] + Second column: [2 5 8] + Third column: [3 6 9] + [[1 2 3] + [4 5 6] + [7 8 9]] + + +## Slicing Numpy array + +Slicing in numpy is similar to slicing in python list + + +```python +two_dimension_array = np.array([[1,2,3],[4,5,6], [7,8,9]]) +first_two_rows_and_columns = two_dimension_array[0:2, 0:2] +print(first_two_rows_and_columns) +``` + + [[1 2] + [4 5]] + + +### How to reverse the rows and the whole array? + + +```python +two_dimension_array[::] + +``` + + + + + array([[1, 2, 3], + [4, 5, 6], + [7, 8, 9]]) + + + +### Reverse the row and column positions + + +```python +two_dimension_array = np.array([[1,2,3],[4,5,6], [7,8,9]]) +two_dimension_array[::-1,::-1] +``` + + + + + array([[9, 8, 7], + [6, 5, 4], + [3, 2, 1]]) + + + +## How to represent missing values and infinite? + + +```python +print(two_dimension_array) +two_dimension_array[1,1] = 55 +two_dimension_array[1,2] =44 +print(two_dimension_array) +``` + + [[1 2 3] + [4 5 6] + [7 8 9]] + [[ 1 2 3] + [ 4 55 44] + [ 7 8 9]] + + + +```python +# Numpy Zeroes +# numpy.zeros(shape, dtype=float, order='C') +numpy_zeroes = np.zeros((3,3),dtype=int,order='C') +numpy_zeroes +``` + + + + + array([[0, 0, 0], + [0, 0, 0], + [0, 0, 0]]) + + + + +```python +# Numpy Zeroes +numpy_ones = np.ones((3,3),dtype=int,order='C') +print(numpy_ones) +``` + + [[1 1 1] + [1 1 1] + [1 1 1]] + + + +```python +twoes = numpy_ones * 2 +``` + + +```python +# Reshape +# numpy.reshape(), numpy.flatten() +first_shape = np.array([(1,2,3), (4,5,6)]) +print(first_shape) +reshaped = first_shape.reshape(3,2) +print(reshaped) + +``` + + [[1 2 3] + [4 5 6]] + [[1 2] + [3 4] + [5 6]] + + + +```python +flattened = reshaped.flatten() +flattened +``` + + + + + array([1, 2, 3, 4, 5, 6]) + + + + +```python +## Horitzontal Stack +np_list_one = np.array([1,2,3]) +np_list_two = np.array([4,5,6]) + +print(np_list_one + np_list_two) + +print('Horizontal Append:', np.hstack((np_list_one, np_list_two))) +``` + + [5 7 9] + Horizontal Append: [1 2 3 4 5 6] + + + +```python +## Vertical Stack +print('Vertical Append:', np.vstack((np_list_one, np_list_two))) +``` + + Vertical Append: [[1 2 3] + [4 5 6]] + + +#### Generating Random Numbers + + +```python +# Generate a random float number +random_float = np.random.random() +random_float +``` + + + + + 0.018929887384753874 + + + + +```python +0.6661632875670657 +``` + + + + + 0.6661632875670657 + + + + +```python +# Generate a random float number +random_floats = np.random.random(5) +random_floats +``` + + + + + array([0.26392192, 0.35842215, 0.87908478, 0.41902195, 0.78926418]) + + + + +```python +# Generating a random integers between 0 and 10 +random_int = np.random.randint(0, 11) +random_int +``` + + + + + 4 + + + + +```python +7 +``` + + + + + 7 + + + + +```python +# Generating a random integers between 2 and 11, and creating a one row array +random_int = np.random.randint(2,10, size=4) +random_int +``` + + + + + array([8, 8, 8, 2]) + + + + +```python +# Generating a random integers between 0 and 10 +random_int = np.random.randint(2,10, size=(3,3)) +random_int +``` + + + + + array([[3, 5, 3], + [7, 3, 6], + [2, 3, 3]]) + + + + +```python +# Generate random numbers +# np.random.normal(mu, sigma, size) +normal_array = np.random.normal(79, 15, 80) +normal_array + +``` + + + + + array([ 89.49990595, 82.06056961, 107.21445842, 38.69307086, + 47.85259157, 93.07381061, 76.40724259, 78.55675184, + 72.17358173, 47.9888899 , 65.10370622, 76.29696568, + 95.58234254, 68.14897213, 38.75862686, 122.5587927 , + 67.0762565 , 95.73990864, 81.97454563, 92.54264805, + 59.37035153, 77.76828101, 52.30752166, 64.43109931, + 62.63695351, 90.04616138, 75.70009094, 49.87586877, + 80.22002414, 68.56708848, 76.27791052, 67.24343975, + 81.86363935, 78.22703433, 102.85737041, 65.15700341, + 84.87033426, 76.7569997 , 64.61321853, 67.37244562, + 74.4068773 , 58.65119655, 71.66488727, 53.42458179, + 70.26872028, 60.96588544, 83.56129414, 72.14255326, + 81.00787609, 71.81264853, 72.64168853, 86.56608717, + 94.94667321, 82.32676973, 70.5165446 , 85.43061003, + 72.45526212, 87.34681775, 87.69911217, 103.02831489, + 75.28598596, 67.17806893, 92.41274447, 101.06662611, + 87.70013935, 70.73980645, 46.40368207, 50.17947092, + 61.75618542, 90.26191397, 78.63968639, 70.84550744, + 88.91826581, 103.91474733, 66.3064638 , 79.49726264, + 70.81087439, 83.90130623, 87.58555972, 59.95462521]) + + + +## Numpy and Statistics + + +```python +import matplotlib.pyplot as plt +import seaborn as sns +sns.set() +plt.hist(normal_array, color="grey", bins=50) +``` + + + + + (array([2., 0., 0., 0., 1., 2., 2., 0., 2., 0., 0., 1., 2., 2., 1., 4., 3., + 4., 2., 7., 2., 2., 5., 4., 2., 4., 3., 2., 1., 5., 3., 0., 3., 2., + 1., 0., 0., 1., 3., 0., 1., 0., 0., 0., 0., 0., 0., 0., 0., 1.]), + array([ 38.69307086, 40.37038529, 42.04769973, 43.72501417, + 45.4023286 , 47.07964304, 48.75695748, 50.43427191, + 52.11158635, 53.78890079, 55.46621523, 57.14352966, + 58.8208441 , 60.49815854, 62.17547297, 63.85278741, + 65.53010185, 67.20741628, 68.88473072, 70.56204516, + 72.23935959, 73.91667403, 75.59398847, 77.27130291, + 78.94861734, 80.62593178, 82.30324622, 83.98056065, + 85.65787509, 87.33518953, 89.01250396, 90.6898184 , + 92.36713284, 94.04444727, 95.72176171, 97.39907615, + 99.07639058, 100.75370502, 102.43101946, 104.1083339 , + 105.78564833, 107.46296277, 109.14027721, 110.81759164, + 112.49490608, 114.17222052, 115.84953495, 117.52684939, + 119.20416383, 120.88147826, 122.5587927 ]), + ) + + + + +```python +# numpy.asarray() +# Asarray +# The asarray()function is used when you want to convert an input to an array. +# The input could be a lists, tuple, ndarray, etc. +``` + + +```python +four_by_four_matrix = np.matrix(np.ones((4,4), dtype=float)) +``` + + +```python +four_by_four_matrix +``` + +matrix([[1., 1., 1., 1.], + [1., 1., 1., 1.], + [1., 1., 1., 1.], + [1., 1., 1., 1.]]) + + +```python +np.asarray(four_by_four_matrix)[2] = 2 +four_by_four_matrix +``` + +matrix([[1., 1., 1., 1.], + [1., 1., 1., 1.], + [2., 2., 2., 2.], + [1., 1., 1., 1.]]) + + +```python +# numpy.arange() in Python with Example +# Whay is Arrange? +# Sometimes, you want to create values that are evenly spaced within a defined interval. +# For instance, you want to create values from 1 to 10; you can use numpy.arange() function + +``` + + +```python +# creating list using range(starting, stop, step) +lst = range(0, 11, 2) +lst +``` + + +```python +range(0, 11, 2) +``` + + +```python +for l in lst: + print(l) +``` + +0 + 2 + 4 + 6 + 8 + 10 + + +```python +# Similar to range arange numpy.arange(start, stop, step) +whole_numbers = np.arange(0, 20, 1) +whole_numbers +``` + +array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19]) + + +```python +natural_numbers = np.arange(1, 20, 1) +natural_numbers +``` + + +```python +odd_numbers = np.arange(1, 20, 2) +odd_numbers +``` + + + + + array([ 1, 3, 5, 7, 9, 11, 13, 15, 17, 19]) + + + + +```python +even_numbers = np.arange(2, 20, 2) +even_numbers +``` + + + + + array([ 2, 4, 6, 8, 10, 12, 14, 16, 18]) + + + + +```python +# numpy.linspace() +# numpy.logspace() in Python with Example +# For instance, it can be used to create 10 values from 1 to 5 evenly spaced. +np.linspace(1.0, 5.0, num=10) +``` + + + + + array([1. , 1.44444444, 1.88888889, 2.33333333, 2.77777778, + 3.22222222, 3.66666667, 4.11111111, 4.55555556, 5. ]) + + + + +```python +# not to include the last value in the interval +np.linspace(1.0, 5.0, num=5, endpoint=False) +``` + + + + + array([1. , 1.8, 2.6, 3.4, 4.2]) + + + + +```python +# LogSpace +# LogSpace returns even spaced numbers on a log scale. Logspace has the same parameters as np.linspace. + +# Syntax: + +# numpy.logspace(start, stop, num, endpoint) +``` + + +```python +np.logspace(2, 4.0, num=4) +``` + + + + + array([ 100. , 464.15888336, 2154.43469003, 10000. ]) + + + + +```python +# to check the size of an array +x = np.array([1,2,3], dtype=np.complex128) +``` + + +```python +x +``` + + + + + array([1.+0.j, 2.+0.j, 3.+0.j]) + + + + +```python +x.itemsize +``` + + + + + 16 + + + + +```python +16 +``` + + + + + 16 + + + + +```python +# indexing and Slicing NumPy Arrays in Python +np_list = np.array([(1,2,3), (4,5,6)]) +np_list + +``` + + + + + array([[1, 2, 3], + [4, 5, 6]]) + + + + +```python +print('First row: ', np_list[0]) +print('Second row: ', np_list[1]) + +``` + + First row: [1 2 3] + Second row: [4 5 6] + + + +```python +print('First column: ', np_list[:,0]) +print('Second column: ', np_list[:,1]) +print('Third column: ', np_list[:,2]) + +``` + + First column: [1 4] + Second column: [2 5] + Third column: [3 6] + + +### NumPy Statistical Functions with Example + +NumPy has quite useful statistical functions for finding minimum, maximum, mean, median, percentile,standard deviation and variance, etc from the given elements in the array. +The functions are explained as follows โˆ’ +Statistical function +Numpy is equipped with the robust statistical function as listed below + +- Numpy Functions + - Min np.min() + - Max np.max() + - Mean np.mean() + - Median np.median() + - Varience + - Percentile + - Standard deviation np.std() + + +```python +np_normal_dis = np.random.normal(5, 0.5, 100) +np_normal_dis +## min, max, mean, median, sd +print('min: ', two_dimension_array.min()) +print('max: ', two_dimension_array.max()) +print('mean: ',two_dimension_array.mean()) +# print('median: ', two_dimension_array.median()) +print('sd: ', two_dimension_array.std()) +``` + + min: 1 + max: 55 + mean: 14.777777777777779 + sd: 18.913709183069525 + + + +```python +min: 1 +max: 55 +mean: 14.777777777777779 +sd: 18.913709183069525 +``` + + +```python +print(two_dimension_array) +print('Column with minimum: ', np.amin(two_dimension_array,axis=0)) +print('Column with maximum: ', np.amax(two_dimension_array,axis=0)) +print('=== Row ==') +print('Row with minimum: ', np.amin(two_dimension_array,axis=1)) +print('Row with maximum: ', np.amax(two_dimension_array,axis=1)) +``` + + [[ 1 2 3] + [ 4 55 44] + [ 7 8 9]] + Column with minimum: [1 2 3] + Column with maximum: [ 7 55 44] + === Row == + Row with minimum: [1 4 7] + Row with maximum: [ 3 55 9] + + +### How to create repeating sequences? + + +```python +a = [1,2,3] + +# Repeat whole of 'a' two times +print('Tile: ', np.tile(a, 2)) + +# Repeat each element of 'a' two times +print('Repeat: ', np.repeat(a, 2)) + +``` + + Tile: [1 2 3 1 2 3] + Repeat: [1 1 2 2 3 3] + + +### How to generate random numbers? + + +```python +# One random number between [0,1) +one_random_num = np.random.random() +one_random_in = np.random +print(one_random_num) +``` + + 0.6149403282678213 + + + +```python +0.4763968133790438 +``` + + + + + 0.4763968133790438 + + + + +```python +# Random numbers between [0,1) of shape 2,3 +r = np.random.random(size=[2,3]) +print(r) +``` + + [[0.13031737 0.4429537 0.1129527 ] + [0.76811539 0.88256594 0.6754075 ]] + + + +```python +print(np.random.choice(['a', 'e', 'i', 'o', 'u'], size=10)) +``` + + ['u' 'o' 'o' 'i' 'e' 'e' 'u' 'o' 'u' 'a'] + + + +```python +['i' 'u' 'e' 'o' 'a' 'i' 'e' 'u' 'o' 'i'] +``` + + + + + ['iueoaieuoi'] + + + + +```python +## Random numbers between [0, 1] of shape 2, 2 +rand = np.random.rand(2,2) +rand +``` + + + + + array([[0.97992598, 0.79642484], + [0.65263629, 0.55763145]]) + + + + +```python +rand2 = np.random.randn(2,2) +rand2 + +``` + + + + + array([[ 1.65593322, -0.52326621], + [ 0.39071179, -2.03649407]]) + + + + +```python +# Random integers between [0, 10) of shape 2,5 +rand_int = np.random.randint(0, 10, size=[5,3]) +rand_int +``` + + + + + array([[0, 7, 5], + [4, 1, 4], + [3, 5, 3], + [4, 3, 8], + [4, 6, 7]]) + + + + +```python +from scipy import stats +np_normal_dis = np.random.normal(5, 0.5, 1000) # mean, standard deviation, number of samples +np_normal_dis +## min, max, mean, median, sd +print('min: ', np.min(np_normal_dis)) +print('max: ', np.max(np_normal_dis)) +print('mean: ', np.mean(np_normal_dis)) +print('median: ', np.median(np_normal_dis)) +print('mode: ', stats.mode(np_normal_dis)) +print('sd: ', np.std(np_normal_dis)) +``` + + min: 3.557811005458804 + max: 6.876317743643499 + mean: 5.035832048106663 + median: 5.020161980441937 + mode: ModeResult(mode=array([3.55781101]), count=array([1])) + sd: 0.489682424165213 + + + +```python +plt.hist(np_normal_dis, color="grey", bins=21) +plt.show() +``` + + +![png](test_files/test_121_0.png) + + + +```python +# numpy.dot(): Dot Product in Python using Numpy +# Dot Product +# Numpy is powerful library for matrices computation. For instance, you can compute the dot product with np.dot + +# Syntax + +# numpy.dot(x, y, out=None) +``` + + +```python +## Linear algebra +### Dot product: product of two arrays +f = np.array([1,2]) +g = np.array([4,5]) +### 1*4+2*5 +np.dot(f, g) +``` + + + + + 14 + + + + +```python +14 +``` + + + + + 14 + + + +### Linear Algebra +1. Dot Product + + +```python +## Linear algebra +### Dot product: product of two arrays +f = np.array([1,2,3]) +g = np.array([4,5,3]) +### 1*4+2*5 + 3*6 +np.dot(f, g) +``` + + + + + 23 + + + + +```python +23 +``` + + + + + 23 + + + +### NumPy Matrix Multiplication with np.matmul() + + +```python +### Matmul: matruc product of two arrays +h = [[1,2],[3,4]] +i = [[5,6],[7,8]] +### 1*5+2*7 = 19 +np.matmul(h, i) +``` + + + + + array([[19, 22], + [43, 50]]) + + + + +```python +## Determinant 2*2 matrix +### 5*8-7*6np.linalg.det(i) +``` + + +```python +np.linalg.det(i) +``` + + + + + -1.999999999999999 + + + + +```python +-1.999999999999999 +``` + + + + + -1.999999999999999 + + + + +```python +Z = np.zeros((8,8)) +Z[1::2,::2] = 1 +Z[::2,1::2] = 1 +``` + + +```python +Z +``` + + + + + array([[0., 1., 0., 1., 0., 1., 0., 1.], + [1., 0., 1., 0., 1., 0., 1., 0.], + [0., 1., 0., 1., 0., 1., 0., 1.], + [1., 0., 1., 0., 1., 0., 1., 0.], + [0., 1., 0., 1., 0., 1., 0., 1.], + [1., 0., 1., 0., 1., 0., 1., 0.], + [0., 1., 0., 1., 0., 1., 0., 1.], + [1., 0., 1., 0., 1., 0., 1., 0.]]) + + + + +```python +new_list = [ x + 2 for x in range(0, 11)] +``` + + +```python +new_list +``` + + + + + [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] + + + + +```python +[2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] +``` + + + + + [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] + + + + +```python +np_arr = np.array(range(0, 11)) +np_arr + 2 +``` + + + + + array([ 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]) + + + +We use linear equation for quatities which have linear relationship. Let's see the example below: + + +```python +temp = np.array([1,2,3,4,5]) +pressure = temp * 2 + 5 +pressure +``` + + + + + array([ 7, 9, 11, 13, 15]) + + + + +```python +plt.plot(temp,pressure) +plt.xlabel('Temperature in oC') +plt.ylabel('Pressure in atm') +plt.title('Temperature vs Pressure') +plt.xticks(np.arange(0, 6, step=0.5)) +plt.show() +``` + + +![png](test_files/test_141_0.png) + + +To draw the Gaussian normal distribution using numpy. As you can see below, the numpy can generate random numbers. To create random sample, we need the mean(mu), sigma(standard deviation), mumber of data points. + + +```python +mu = 28 +sigma = 15 +samples = 100000 + +x = np.random.normal(mu, sigma, samples) +ax = sns.distplot(x); +ax.set(xlabel="x", ylabel='y') +plt.show() +``` + + +![png](test_files/test_143_0.png) + + + + +# Summery + +To summarise, the main differences with python lists are: + +1. Arrays support vectorised operations, while lists donโ€™t. +1. Once an array is created, you cannot change its size. You will have to create a new array or overwrite the existing one. +1. Every array has one and only one dtype. All items in it should be of that dtype. +1. An equivalent numpy array occupies much less space than a python list of lists. +1. numpy arrays support boolean indexing. + +## ๐Ÿ’ป Exercises: Day 24 +1. Repeat all the examples diff --git a/test0.md b/test0.md new file mode 100644 index 00000000..0ae037f0 --- /dev/null +++ b/test0.md @@ -0,0 +1,1031 @@ +# Day 24 + +## Python for Statistical Analysis + +### Statistics + +Statistics is the discipline that concerns the _collection_, _organization_, _displaying_, _analysis_, _interpretation_ and _presentation_ of data. +Statistics is a sub field of mathematics that is universally agreed to be a prerequisite for a deeper understanding of data science and machine learning. Statistics is a very broad field but we will focus in this section only on the most relevant part. +After completing this challenge, you may go to web development, data analysis, machine learning and data science path. Whatever path you may follow, at some point you will in your career you will get data which you may work on. + +### Data + +What is data? Data is any set of characters that is gathered and translated for some purpose, usually analysis. It can be any character, including text and numbers, pictures, sound, or video. If data is not put into context, it doesn't do anything to a human or computer. To make sense from data we need to work on the data using different tools. +The work flow of data analysis, data science or machine learning starts from data. +Either we create or get data. Data can be found as small or big data format. Most of the data types we will get have been covered in the file handling section. + +### Statistics Module + +The python _statistics_ module provides functions for calculating mathematical statistics of numeric data. The module is not intended to be a competitor to third-party libraries such as NumPy, SciPy, or proprietary full-featured statistics packages aimed at professional statisticians such as Minitab, SAS and Matlab. It is aimed at the level of graphing and scientific calculators. + +## NumPy + +In the first section we defined python as a great general-purpose programming language on its own, but with the help of other popular libraries (numpy, scipy, matplotlib, pandas etc) it becomes a powerful environment for scientific computing. + +Numpy is the core library for scientific computing in Python. It provides a high-performance multidimensional array object, and tools for working with arrays. + +So far, we have been using vscode but from now on I would recommend using Jupyter Notebook. To access jupter notebook let's install [anaconda](https://www.anaconda.com/). If you are using anaconda most of the common packages are included and you don't have install packages if you installed anaconda. + +```sh +asabeneh@Asabeneh:~/Desktop/30DaysOfPython$ pip install numpy +``` + +### Importing NumPy + +Jupyter notebook is available if your are in favor of [jupyter notebook](https://github.com/Asabeneh/data-science-for-everyone/blob/master/numpy/numpy.ipynb) + +```py +# How to import numpy +import numpy as np +# How to check the version of the numpy package +print('numpy:', np.__version__) +# Checking the available methods +print(dir(np)) +``` + +### Creating numpy array using + +```py +# Creating python List +python_list = [1,2,3,4,5] +# Checking data types +print(type (python_list)) +print(python_list) +two_dimensional_list = [[0,1,2], [3,4,5], [6,7,8]] +print(two_dimensional_list) +``` + +```sh + +[1 2 3 4 5] +``` + +```py +# Creating Numpy(Numerical Python) array from python list +numpy_array_from_list = np.array(python_list) +print(type (numpy_array_from_list)) +print(numpy_array_from_list) +``` + +Creating list with a float data type + +```py +python_list = [1,2,3,4,5] +numy_array_from_list2 = np.array(python_list, dtype=float) +print(numy_array_from_list2) +``` + +```sh +array([1., 2., 3., 4., 5.]) +``` + +Creating list with a boolean data type + +```py +numpy_bool_array = np.array([0, 1, -1, 0, 0], dtype=bool) +print(numpy_bool_array) +``` + +```sh +array([False, True, True, False, False]) +``` + +Creating multidimensional array using numpy + +```py +two_dimensional_list = [[0,1,2], [3,4,5], [6,7,8]] +numpy_two_dimensional_list = np.array(two_dimensional_list) +print(type (numpy_two_dimensional_list)) +print(numpy_two_dimensional_list) +``` + +```sh +array([[0, 1, 2], + [3, 4, 5], + [6, 7, 8]]) +``` + +### Converting numpy array to list + +```py +# We can always convert an array back to a python list using tolist(). +np_to_list = numpy_array_from_list.tolist() +print(type (np_to_list)) +print('one dimensional array:', np_to_list) +print('two dimensional array: ', numpy_two_dimensional_list.tolist()) +``` + +```sh + +one dimensional array: [1, 2, 3, 4, 5] +two dimensional array: [[0, 1, 2], [3, 4, 5], [6, 7, 8]] +``` + +### Creating numpy array from tuple + +```py +# Numpy array from tuple +# Creating tuple in Python + +python_tuple = (1,2,3,4,5) +print(type (python_tuple)) +print('python_tuple: ', python_tuple) + +numpy_array_from_tuple = np.array(python_tuple) +print(type (numpy_array_from_tuple)) +print('numpy_array_from_tuple: ', numpy_array_from_tuple) +``` + +```sh + +python_tuple: (1, 2, 3, 4, 5) + +numpy_array_from_tuple: array([1, 2, 3, 4, 5]) +``` + +### Shape of numpy array + +The shape method provide the shape of the array as a tuple. The first is the row and the second is the column + +```py +nums = np.array([1, 2, 3, 4, 5]) +print(nums) +print('shape of nums: ', nums.shape) +print(numpy_two_dimensional_list) +print('shape of numpy_two_dimensional_list: ', numpy_two_dimensional_list.shape) +three_by_four_array = np.array([[0, 1, 2, 3], + [4,5,6,7], + [8,9,10, 11]]) +print(three_by_four_array.shape) +``` + +```sh +[1 2 3 4 5] +shape of nums: (5,) +[[0 1 2] +[3 4 5] +[6 7 8]] +shape of numpy_two_dimensional_list: (3, 3) +(3, 4) +``` + +### Data type of numpy array + +Type of data types: str, int, float, complex, bool, list, None + +```py +int_lists = [-3, -2, -1, 0, 1, 2,3] +int_array = np.array(int_lists) +float_array = np.array(int_lists, dtype=float) + +print(int_array) +print(int_array.dtype) +print(float_array) +print(float_array.dtype) +``` + +```sh +[-3 -2 -1 0 1 2 3] +int64 +[-3. -2. -1. 0. 1. 2. 3.] +float64 +``` + +### Size of a numpy array +In addition to *len* we can also use size to get the number of items in a numpy array +```py +numpy_array_from_list = np.array([1, 2, 3, 4, 5]) +two_dimensional_list = np.array([[0, 1, 2], + [3, 4, 5], + [6, 7, 8]]) +print(len(numpy_array_from_list)) # 5 +print(len(two_dimensional_list)) # 3 + +print(numpy_array_from_list.size) # 5 +print(two_dimensional_list.size) # 3 + +``` + +### Mathematical Operation + +```py +# Mathematical Operation +# Addition +print('original array: ', numpy_array_from_list) +ten_plus_original = numpy_array_from_list + 10 +print(ten_plus_original) +ten_minus_original = numpy_array_from_list - 10 +print(ten_minus_original) +# Multiplication +ten_times_original = numpy_array_from_list * 10 +print(ten_times_original) +``` + +```sh +original array: [1 2 3 4 5] +[11 12 13 14 15] +[-9 -8 -7 -6 -5] +[10 20 30 40 50] +``` + +### Checking numpy array data types + + +```py +#Int, Float numbers + +numpy_int_list = np.array([1,2,3,4]) +numpy_float_list = np.array([1.1, 2.0,3.2]) +numpy_float_list2 = np.array([1.1,2.0,3.2]) + +print(numpy_int_list.dtype) +print(numpy_float_list2.dtype) +print(numpy_float_list.dtype) +``` + +```sh +int64 +float64 +float64 +``` + +### Converting types + +```py +# Converting type from float to int +numpy_float_list = np.array([1.1, 2.0,3.2]) +numpy_float_list.astype('int') +print(numpy_float_list) +``` + +```sh +array([1, 2, 3]) +``` + +```py +# Converting type from int to str +numpy_float_list.astype('int').astype('str') +``` + +```sh +array(['1', '2', '3'], dtype=' +[[1 2 3] + [4 5 6] + [7 8 9]] +Shape: (3, 3) +Size: 9 +Data type: int64 +``` + +### Getting items from a numpy array + +```py +# 2 Dimension Array +two_dimension_array = np.array([[1,2,3],[4,5,6], [7,8,9]]) +first_row = two_dimension_array[0] +second_row = two_dimension_array[1] +third_row = two_dimension_array[2] +print('First row:', first_row) +print('Second row:', second_row) +print('Third row: ', third_row) +``` + +```sh +First row: [1 2 3] +Second row: [4 5 6] +Third row: [7 8 9] +``` + +```py +first_column= two_dimension_array[:,0] +second_column = two_dimension_array[:,1] +third_column = two_dimension_array[:,2] +print('First column:', first_column) +print('Second column:', second_column) +print('Third column: ', third_column) +print(two_dimension_array) + +``` + +```sh +First column: [1 4 7] +Second column: [2 5 8] +Third column: [3 6 9] +[[1 2 3] + [4 5 6] + [7 8 9]] +``` + +Slicing in numpy is similar to slicing in python list + +```py +first_two_rows_and_columns = two_dimension_array[0:2, 0:2] +print(first_two_rows_and_columns) +``` + +```sh +array([[1, 2], + [4, 5]]) +``` + +### How to reverse the rows and the whole array? + +````python +two_dimension_array[::] +``` + array([[1, 2, 3], + [4, 5, 6], + [7, 8, 9]]) + + +### Reverse only the row positions + + +```python +two_dimension_array[::-1,] +```` + + array([[7, 8, 9], + [4, 5, 6], + [1, 2, 3]]) + +### Reverse the row and column positions + +```python +two_dimension_array[::-1,::-1] +``` + + array([[9, 8, 7], + [6, 5, 4], + [3, 2, 1]]) + +## How to represent missing values and infinite? + +```python +print(two_dimension_array) +two_dimension_array[1,1] = 55 +two_dimension_array[1,2] =44 +print(two_dimension_array) +``` + + [[1 2 3] + [4 5 6] + [7 8 9]] + [[ 1 2 3] + [ 4 55 44] + [ 7 8 9]] + +```python +# Numpy Zeroes +# numpy.zeros(shape, dtype=float, order='C') +numpy_zeroes = np.zeros((3,3),dtype=int,order='C') +numpy_zeroes +``` + + array([[0, 0, 0], + [0, 0, 0], + [0, 0, 0]]) + +```python +# Numpy Zeroes +numpy_ones = np.ones((3,3),dtype=int,order='C') +print(numpy_ones) +``` + + [[1 1 1] + [1 1 1] + [1 1 1]] + +```python +twoes = numpy_ones * 2 +``` + +```python +# Reshape +# numpy.reshape(), numpy.flatten() +first_shape = np.array([(1,2,3), (4,5,6)]) +print(first_shape) +reshaped = first_shape.reshape(3,2) +print(reshaped) + +``` + + [[1 2 3] + [4 5 6]] + [[1 2] + [3 4] + [5 6]] + +```python +flattened = reshaped.flatten() +flattened +``` + + array([1, 2, 3, 4, 5, 6]) + +```python +## Horitzontal Stack +np_list_one = np.array([1,2,3]) +np_list_two = np.array([4,5,6]) + +print(np_list_one + np_list_two) + +print('Horizontal Append:', np.hstack((np_list_one, np_list_two))) +``` + + [5 7 9] + Horizontal Append: [1 2 3 4 5 6] + +```python +## Vertical Stack +print('Vertical Append:', np.vstack((np_list_one, np_list_two))) +``` + + Vertical Append: [[1 2 3] + [4 5 6]] + +#### Generating Random Numbers + +```python +# Generate a random float number +random_float = np.random.random() +random_float +``` + + 0.6661632875670657 + +```python +# Generate a random float number +random_floats = np.random.random(5) +random_floats +``` + + array([0.12945387, 0.1859908 , 0.47805876, 0.51996342, 0.52458233]) + +```python +# Generating a random integers between 0 and 10 +random_int = np.random.randint(0, 11) +random_int +``` + + 7 + +```python +# Generating a random integers between 2 and 11, and creating a one row array +random_int = np.random.randint(2,10, size=4) +random_int +``` + + array([5, 8, 8, 9]) + +```python +# Generating a random integers between 0 and 10 +random_int = np.random.randint(2,10, size=(3,3)) +random_int +``` + + array([[8, 9, 5], + [9, 8, 3], + [2, 3, 8]]) + +```python +# Generate random numbers +# np.random.normal(mu, sigma, size) +normal_array = np.random.normal(79, 15, 80) +normal_array + +``` + + array([ 76.67233671, 87.8686846 , 64.80771996, 79.44136527, + 68.83066184, 102.85967631, 74.40838573, 58.56053793, + 93.76814784, 82.16082568, 86.80548555, 77.95291907, + 97.71514434, 95.94083876, 82.53018033, 73.74619803, + 67.07970869, 102.20984782, 81.67766599, 73.82096132, + 90.17632538, 102.87342877, 84.19855251, 81.11888938, + 63.42782472, 75.3734846 , 79.04423914, 56.52607352, + 58.30505483, 54.69555571, 63.25792739, 88.75239018, + 85.44533248, 59.76883843, 39.72683784, 78.1029094 , + 54.19952262, 82.383277 , 87.01010766, 73.09642208, + 81.99276776, 82.58990091, 72.71303439, 101.73499367, + 73.65596295, 81.89611334, 96.14703307, 74.9629613 , + 84.79491744, 90.77830881, 70.69085365, 69.27799996, + 74.07836137, 56.79410721, 76.08072393, 83.28246182, + 83.66382654, 80.79644627, 83.39674788, 73.68044176, + 59.74405724, 47.50763054, 50.99870066, 85.53776901, + 80.61131428, 62.66726385, 69.8289171 , 58.2394869 , + 86.5158869 , 86.92976422, 65.12965299, 101.9918336 , + 73.3855881 , 99.29788439, 82.48238578, 83.14592314, + 109.13987986, 87.18461073, 73.18647475, 76.04712709, + + ]) + +## Numpy and Statistics + +```python +import matplotlib.pyplot as plt +import seaborn as sns +sns.set() +plt.hist(normal_array, color="grey", bins=50) +``` + + (array([ 1., 0., 1., 2., 0., 1., 3., 3., 4., 2., 4., 10., 7., + 12., 15., 13., 20., 26., 16., 32., 36., 42., 38., 37., 35., 54., + 50., 40., 40., 55., 56., 49., 45., 29., 37., 26., 26., 23., 28., + 12., 22., 10., 11., 5., 3., 6., 4., 4., 3., 2.]), + array([ 26.42484343, 28.2913796 , 30.15791576, 32.02445192, + 33.89098809, 35.75752425, 37.62406041, 39.49059657, + 41.35713274, 43.2236689 , 45.09020506, 46.95674123, + 48.82327739, 50.68981355, 52.55634972, 54.42288588, + 56.28942204, 58.1559582 , 60.02249437, 61.88903053, + 63.75556669, 65.62210286, 67.48863902, 69.35517518, + 71.22171134, 73.08824751, 74.95478367, 76.82131983, + 78.687856 , 80.55439216, 82.42092832, 84.28746449, + 86.15400065, 88.02053681, 89.88707297, 91.75360914, + 93.6201453 , 95.48668146, 97.35321763, 99.21975379, + 101.08628995, 102.95282611, 104.81936228, 106.68589844, + 108.5524346 , 110.41897077, 112.28550693, 114.15204309, + 116.01857926, 117.88511542, 119.75165158]), + ) + +```python + +``` + +```python +# numpy.asarray() +# Asarray +# The asarray()function is used when you want to convert an input to an array. +# The input could be a lists, tuple, ndarray, etc. +``` + +```python +four_by_four_matrix = np.matrix(np.ones((4,4), dtype=float)) +``` + +```python +four_by_four_matrix +``` + matrix([[1., 1., 1., 1.], + [1., 1., 1., 1.], + [1., 1., 1., 1.], + [1., 1., 1., 1.]]) + +```python +np.asarray(four_by_four_matrix)[2] = 2 +four_by_four_matrix +``` + matrix([[1., 1., 1., 1.], + [1., 1., 1., 1.], + [2., 2., 2., 2.], + [1., 1., 1., 1.]]) + +```python +# numpy.arange() in Python with Example +# Whay is Arrange? +# Sometimes, you want to create values that are evenly spaced within a defined interval. +# For instance, you want to create values from 1 to 10; you can use numpy.arange() function + +``` + +```python +# creating list using range(starting, stop, step) +lst = range(0, 11, 2) +lst +``` + + range(0, 11, 2) + +```python +for l in lst: + print(l) +``` + 0 + 2 + 4 + 6 + 8 + 10 + +```python +# Similar to range arange numpy.arange(start, stop, step) +whole_numbers = np.arange(0, 20, 1) +whole_numbers +``` + array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19]) +```python +natural_numbers = np.arange(1, 20, 1) +natural_numbers +``` + + array([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19]) + +```python +odd_numbers = np.arange(1, 20, 2) +odd_numbers +``` + + array([ 1, 3, 5, 7, 9, 11, 13, 15, 17, 19]) + +```python +even_numbers = np.arange(2, 20, 2) +even_numbers +``` + + array([ 2, 4, 6, 8, 10, 12, 14, 16, 18]) + +```python +# numpy.linspace() +# numpy.logspace() in Python with Example +# For instance, it can be used to create 10 values from 1 to 5 evenly spaced. +np.linspace(1.0, 5.0, num=10) +``` + + array([1. , 1.44444444, 1.88888889, 2.33333333, 2.77777778, + 3.22222222, 3.66666667, 4.11111111, 4.55555556, 5. ]) + +```python +# not to include the last value in the interval +np.linspace(1.0, 5.0, num=5, endpoint=False) +``` + + array([1. , 1.8, 2.6, 3.4, 4.2]) + +```python +# LogSpace +# LogSpace returns even spaced numbers on a log scale. Logspace has the same parameters as np.linspace. + +# Syntax: + +# numpy.logspace(start, stop, num, endpoint) +``` + +```python +np.logspace(2, 4.0, num=4) +``` + + array([ 100. , 464.15888336, 2154.43469003, 10000. ]) + +```python +# to check the size of an array +x = np.array([1,2,3], dtype=np.complex128) +``` + +```python +x +``` + + array([1.+0.j, 2.+0.j, 3.+0.j]) + +```python +x.itemsize +``` + + 16 + +```python +# indexing and Slicing NumPy Arrays in Python +np_list = np.array([(1,2,3), (4,5,6)]) +np_list + +``` + + array([[1, 2, 3], + [4, 5, 6]]) + +```python +print('First row: ', np_list[0]) +print('Second row: ', np_list[1]) + +``` + + First row: [1 2 3] + Second row: [4 5 6] + +```python +print('First column: ', np_list[:,0]) +print('Second column: ', np_list[:,1]) +print('Third column: ', np_list[:,2]) + +``` + + First column: [1 4] + Second column: [2 5] + Third column: [3 6] + +### NumPy Statistical Functions with Example + +NumPy has quite useful statistical functions for finding minimum, maximum, mean, median, percentile,standard deviation and variance, etc from the given elements in the array. +The functions are explained as follows โˆ’ +Statistical function +Numpy is equipped with the robust statistical function as listed below + +- Numpy Functions + - Min np.min() + - Max np.max() + - Mean np.mean() + - Median np.median() + - Standard deviation np.std() + +```python +np_normal_dis = np.random.normal(5, 0.5, 100) +np_normal_dis +## min, max, mean, median, sd +print('min: ', two_dimension_array.min()) +print('max: ', two_dimension_array.max()) +print('mean: ',two_dimension_array.mean()) +# print('median: ', two_dimension_array.median()) +print('sd: ', two_dimension_array.std()) +``` + + min: 1 + max: 55 + mean: 14.777777777777779 + sd: 18.913709183069525 + +```python +print(two_dimension_array) +print('Column with minimum: ', np.amin(two_dimension_array,axis=0)) +print('Column with maximum: ', np.amax(two_dimension_array,axis=0)) +print('=== Row ==') +print('Row with minimum: ', np.amin(two_dimension_array,axis=1)) +print('Row with maximum: ', np.amax(two_dimension_array,axis=1)) +``` + + [[ 1 2 3] + [ 4 55 44] + [ 7 8 9]] + Column with minimum: [1 2 3] + Column with maximum: [ 7 55 44] + === Row == + Row with minimum: [1 4 7] + Row with maximum: [ 3 55 9] + +### How to create repeating sequences? + +```python +a = [1,2,3] + +# Repeat whole of 'a' two times +print('Tile: ', np.tile(a, 2)) + +# Repeat each element of 'a' two times +print('Repeat: ', np.repeat(a, 2)) + +``` + + Tile: [1 2 3 1 2 3] + Repeat: [1 1 2 2 3 3] + +### How to generate random numbers? + +```python +# One random number between [0,1) +one_random_num = np.random.random() +one_random_in = np.random +print(one_random_num) +``` + + 0.4763968133790438 + +```python +# Random numbers between [0,1) of shape 2,3 +r = np.random.random(size=[2,3]) +print(r) +``` + + [[0.67018871 0.71699922 0.36490538] + [0.78086531 0.5779336 0.81444353]] + +```python +print(np.random.choice(['a', 'e', 'i', 'o', 'u'], size=10)) +``` + + ['i' 'u' 'e' 'o' 'a' 'i' 'e' 'u' 'o' 'i'] + +```python + +``` + +```python +## Random numbers between [0, 1] of shape 2, 2 +rand = np.random.rand(2,2) +rand +``` + + array([[0.66811333, 0.1139411 ], + [0.90955775, 0.14954203]]) + +```python +rand2 = np.random.randn(2,2) +rand2 + +``` + + array([[-0.84819546, -0.39626819], + [ 0.9172979 , 0.03661474]]) + +```python +# Random integers between [0, 10) of shape 2,5 +rand_int = np.random.randint(0, 10, size=[5,3]) +rand_int +``` + + array([[2, 7, 0], + [0, 2, 7], + [5, 9, 4], + [6, 0, 8], + [4, 6, 2]]) + +```python + +``` + +```python +from scipy import stats +np_normal_dis = np.random.normal(5, 0.5, 1000) +np_normal_dis +## min, max, mean, median, sd +print('min: ', np.min(np_normal_dis)) +print('max: ', np.max(np_normal_dis)) +print('mean: ', np.mean(np_normal_dis)) +print('median: ', np.median(np_normal_dis)) +print('mode: ', stats.mode(np_normal_dis)) +print('sd: ', np.std(np_normal_dis)) +``` + + min: 3.566493784430423 + max: 6.823091905048957 + mean: 5.034308251615374 + median: 5.0317142506545505 + mode: ModeResult(mode=array([3.56649378]), count=array([1])) + sd: 0.5050902240094916 + +```python +plt.hist(np_normal_dis, color="grey", bins=21) +``` + + (array([ 3., 7., 11., 22., 41., 64., 72., 109., 117., 122., 117., + 93., 94., 47., 36., 20., 15., 5., 3., 0., 2.]), + array([3.56649378, 3.72156989, 3.87664599, 4.03172209, 4.18679819, + 4.34187429, 4.49695039, 4.65202649, 4.80710259, 4.96217869, + 5.11725479, 5.2723309 , 5.427407 , 5.5824831 , 5.7375592 , + 5.8926353 , 6.0477114 , 6.2027875 , 6.3578636 , 6.5129397 , + 6.6680158 , 6.82309191]), + ) + +![png](numpy_files/numpy_108_1.png) + +```python +# numpy.dot(): Dot Product in Python using Numpy +# Dot Product +# Numpy is powerful library for matrices computation. For instance, you can compute the dot product with np.dot + +# Syntax + +# numpy.dot(x, y, out=None) +``` + +```python +## Linear algebra +### Dot product: product of two arrays +f = np.array([1,2]) +g = np.array([4,5]) +### 1*4+2*5 +np.dot(f, g) +``` + + 14 + +```python +## Linear algebra +### Dot product: product of two arrays +f = np.array([1,2,3]) +g = np.array([4,5,3]) +### 1*4+2*5 + 3*6 +np.dot(f, g) +``` + + 23 + +```python +# NumPy Matrix Multiplication with np.matmul() +``` + +```python +### Matmul: matruc product of two arrays +h = [[1,2],[3,4]] +i = [[5,6],[7,8]] +### 1*5+2*7 = 19 +np.matmul(h, i) +``` + + array([[19, 22], + [43, 50]]) + +```python +## Determinant 2*2 matrix +### 5*8-7*6np.linalg.det(i) +``` + +```python +np.linalg.det(i) +``` + + -1.999999999999999 + +```python +Z = np.zeros((8,8)) +Z[1::2,::2] = 1 +Z[::2,1::2] = 1 +``` + +```python +Z +``` + + array([[0., 1., 0., 1., 0., 1., 0., 1.], + [1., 0., 1., 0., 1., 0., 1., 0.], + [0., 1., 0., 1., 0., 1., 0., 1.], + [1., 0., 1., 0., 1., 0., 1., 0.], + [0., 1., 0., 1., 0., 1., 0., 1.], + [1., 0., 1., 0., 1., 0., 1., 0.], + [0., 1., 0., 1., 0., 1., 0., 1.], + [1., 0., 1., 0., 1., 0., 1., 0.]]) + +```python +new_list = [ x + 2 for x in range(0, 11)] +``` + +```python +new_list +``` + + [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] + +```python +np_arr = np.array(range(0, 11)) +np_arr + 2 +``` + + array([ 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]) + +```python +x = np.array([1,2,3,4,5]) +y = x * 2 + 5 +y +``` + + array([ 7, 9, 11, 13, 15]) + +```python +plt.plot(x,y) +plt.xlabel('Temperature in oC') +plt.ylabel('Pressure in atm') +plt.title('Temperature vs Pressure') +plt.xticks(np.arange(0, 6, step=0.5)) +plt.show() +``` + +![png](numpy_files/numpy_122_0.png) + +```python +x = np.random.normal(size=1000) +ax = sns.distplot(x); +ax.set(xlabel="x", ylabel='y') + +``` + + [Text(0, 0.5, 'y'), Text(0.5, 0, 'x')] + +![png](numpy_files/numpy_123_1.png) + +# Summery + +To summarise, the main differences with python lists are: + +1. Arrays support vectorised operations, while lists donโ€™t. +1. Once an array is created, you cannot change its size. You will have to create a new array or overwrite the existing one. +1. Every array has one and only one dtype. All items in it should be of that dtype. +1. An equivalent numpy array occupies much less space than a python list of lists. +1. numpy arrays support boolean indexing. + +## ๐Ÿ’ป Exercises: Day 24 +1. Repeat all the examples \ No newline at end of file diff --git a/test_files/test_121_0.png b/test_files/test_121_0.png new file mode 100644 index 0000000000000000000000000000000000000000..774d2b24d5e6ba90e6208bb33ee5d85643f9c440 GIT binary patch literal 5168 zcma)=2V7HE`^U3LWTp`jMFJ9*)dEU{u&ElvC_@1Uge`_mq7Y^XL0b$30mCa8Stf7`eDe3F}c@A;g2&Uv2i^ZT8fc-+ofR!T_< z007A1j$j=C03b#De`OO?{Ohl&ry@Q;LJ#7cHi z@vlTlsm|&V%Wmg;30=I{;gz(B6@zpf&$umyhw*(z6HqqZd>~`^xzPh&u_Y}8|`7xhv1QW@7%84SlI!t3E z!WxtbUIAgi(}XF``+w=;0vc($bSCL04YvXs%?lD?yi;r?Z01?rVETfp{3FL|iHGGgspi&AF? zm5jL65Y9QyYiXUTYn+Mq9P1A)%^jeF744eVP0@0^zeEb8l1V)1VEI zD}$+8qG$;y4fYEM*vo+pg6H~?obGO&VS=}}0=_daJKDmi1dFEi>4$>6?}tYvm0v_TGYUeMvi?V2 ze2M3WxWZlY{iiC%lNJ{jshMh$V2{oq3Z;2IkrQ2ZKBMcDt-XCs@JPN}`H@*&um`Ko zv{Q@Ic3`_mDJbRT|6}1FrHQR=?pDMKr~y>b#Zk5DSY%tVrMN$Ens0_gXpoF6^+;$^ z2%-C%W0Q=6jBke8Q|V{p@iemFwF3Jv7t4)e_aM$69HXEsEzko%b@ou_iCT?fa+l0Z zwrsO(WF?g%L$W7~*flH?$TN;hnP zFrDgV&A|TBAeLJbhV>RRHy%q4RF$1;t>=vg6!F4CX!=qd12YvMLD6}fQHGD$Yiioy zmz9`!GH9r}rO#IAmPm%r={cG-cIHMOCEYAB7*f?xd)(o(^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h8xp#o_LM70sQ-$i|wXV%%xOc|8H#$z!x5E41ud58I zP_bqW7HS6w>&hZu*7)S=r%URux@7IQzkDL^xpqN{&uUa$Jirwo&Yy4plm{wN_oj}| z*6qhsjb6al^5|!f2qMwX5+w8Q#CwVZ)5xiLij3K}b*a+^rdKDbU06K2NI;KlFYg!j zd@*SmoK*?F70at83VgrK`8E&OwHbi&&Yo57?UODIiHd^X@+upQ%wsvlSb{bvT|zr}WV39{Z5%dpo8GmX}?RO^m)K~!Gow&b-~ zS^g}2uwpz<8!*8Xy9?nLPa(MdVtevhi{F@xXU2XbWzjRv=*QJ__>~w>uqC=8ztQDQ zlapmOer^xGJc*vKA1d8voulXIHf{u>loBQMP$=D0`oI8uLMmGx5pm*5mt4oWi_**r zQ?x2MA9ND^hMolihBQD)WrT1 zLLsdU+KM|VL|!71onnXHe(!{=Xrisqo^@^5^>^8UbyMg~@z>azv0v9ea3I4YGn9|^ zrNQ$NMf+Y_!Y=XKJpj(i4qJZE^WuL1tGkQb literal 0 HcmV?d00001 diff --git a/test_files/test_141_0.png b/test_files/test_141_0.png new file mode 100644 index 0000000000000000000000000000000000000000..4c60471abf2a683d2b7bed024648f198aa0a3919 GIT binary patch literal 12639 zcmZ|02{@GR`#wC3UG`A+M3lX;g)AAe6lG0_$k-X{*tcX!$P&g{5?Qij8-@&uFqX(Z z!ysfEA`RKzXFi|r@BjP0|Koi-4o8l;?|Yv6x$kQ^&-1z@-ZQ$*#K6M<0)d$H^`Iso z5Jdv;!%as6eA4VURtx+`<#$Wpj1Kr0M)w351kuCwto%SAMt1TK#V9`F82C`xU+00p zsW;3Y@z~c1g@%QmXnr~6ms$RhpWiQ{O`E5x39AdD~$Uh z2qXm3hiaJxgq(eD>qYj}(#Z)uqm-IKSZ=MZ=`I z9}z^Wq71fVT{bqhX-ilI2P<3J?-I&O!or*;(ZKHv<(dfzde6*+pwNdfL(qZ;x(Bs_wR}_j>gqjsgeA&8SGN8f;VvNzF`u;__QwgPLHmiiilSJ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9Vz7$ge5^p?`O8Z){HlNTI7UhTw zM?7OJP26dXR*K%khg(xl6zRbG7sU}WRqq1+&_)=+!=W^_)Tmj!Mn&?z;mMmZ8&OZ7 zeBMdBwR+V^)C)F|Kyds1CsCZWaS;2L-9{(k8QPeotbkIDg>Q?PWP&Uz;r7(hd&tm?N3+9N`r>^Ny~)6D)#XE@NIcUVKy6YEn3HjM7> z&S|G7-X5V82S@Nd`p%_#TEoDqg;;=e+k~+DKWTR;YQirM;0@uI9$fAG@&IU11;dp( z+XYIqhc}4c58yJHi`V9uUG4qP-5Rx+Vg|Z>w_4%>rA+X%O|TmKfz_1JVM3sIdlh)aCC<99c_Wr3)EVd~C^Kr4=$IG0UW|2`W%(503_O{{x;^Y{2d z+gn_FMWM?7>Gh?O(uiY|zaRP?Td}?w%m;sqW&y!WJI6amyHOFek8yEJ9wm1fcqLTV?B@5 zj>>lE;i8~nmG_@58g^j#=Hbv<+oN1y&**GXMyI8jh9a8Ux~ z7y2n(`0VGKN7#;zq0Bm4l>rUDfv)}eO`><)hS%MDBK@3S?i6W{Kvuyq7E`Ni=M%$q zNJs(nCp_`d+{_KeuYRQ6m9S-m0uEIq7uJ|!;P7f-vBTQHnH{IkOyGzKrTDB^{5d96 zM-pcY)^>gU`|hpLX-Xjn78lRl6?+rf$uAwdoIPttKcAxPOtpk*}Roav9i>th-JL>pvQ&I>engbeAYUT zz}56#v(m`_&yHE~&EsI6&ggldV^;Jh_E0M*Zp0SD&xMQspN`p1t<@tSS;owIrXWcD zfihn<*a$ZX^|g>qP>jV)EN#Ou%_r|pPq9@Ff7Hz}Jom&ckMi68xs~7D7n%>|zYt5= z(+*r1Zvj1kCI8(NONMSH{|(Lnu1uZ-G-(KP{?#DCz15qfYF-0>3<1*DF@jd#vXA+H E095IgIsgCw literal 0 HcmV?d00001 diff --git a/test_files/test_143_0.png b/test_files/test_143_0.png new file mode 100644 index 0000000000000000000000000000000000000000..447febf3276507e28902e6d6ab301a49621552e9 GIT binary patch literal 12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