diff --git a/numpy/numpy.ipynb b/numpy/numpy.ipynb new file mode 100644 index 0000000..f2e0313 --- /dev/null +++ b/numpy/numpy.ipynb @@ -0,0 +1,137 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:cb8fc4454a69123dcb745c323968d06c15444cee91494edb720893b06e98c249" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# NumPy\n", + "\n", + "* NumPy Arrays, dtype, and shape\n", + "* Common Array Operations\n", + "* Reshaping and In-Place Updating\n", + "* Combining Arrays\n", + "* Creating Fake Data and Adding Noise" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import numpy as np" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## NumPy Arrays, dtypes, and shapes" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "a = np.array([1, 2, 3])\n", + "print(a)\n", + "print(a.shape)\n", + "print(a.dtype)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[1 2 3]\n", + "(3,)\n", + "int64\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "b = np.array([[0, 2, 4], [1, 3, 5]])\n", + "print(b)\n", + "print(b.shape)\n", + "print(b.dtype)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[[0 2 4]\n", + " [1 3 5]]\n", + "(2, 3)\n", + "int64\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "np.zeros(5)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "metadata": {}, + "output_type": "pyout", + "prompt_number": 4, + "text": [ + "array([ 0., 0., 0., 0., 0.])" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "np.ones(shape=(3, 4), dtype=np.int32)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "metadata": {}, + "output_type": "pyout", + "prompt_number": 5, + "text": [ + "array([[1, 1, 1, 1],\n", + " [1, 1, 1, 1],\n", + " [1, 1, 1, 1]], dtype=int32)" + ] + } + ], + "prompt_number": 5 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file