diff --git a/matpltlib/10_subplots.ipynb b/matpltlib/10_subplots.ipynb index d6d2accb..594a4a6c 100644 --- a/matpltlib/10_subplots.ipynb +++ b/matpltlib/10_subplots.ipynb @@ -4,7 +4,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Matplotlib Tutorial: Subplots

" + "

Matplotlib Tutorial: Subplots

" ] }, { @@ -53,12 +53,14 @@ "expense=[2800,3000,2800,3400]\n", "\n", "plt.subplot(2,1,1)\n", - "# income.set_title('Income')\n", "plt.bar(year,income)\n", + "plt.title('Income')\n", "\n", + "plt.subplot(2,1,2)\n", + "plt.bar(year,expense,color='green')\n", + "plt.title('Expense')\n", "\n", - "# plt.subplot(2,1,2)\n", - "# plt.bar(year,expense,color='green')" + "plt.tight_layout()\n" ] } ], diff --git a/matpltlib/4_bar_chart/4_bar_chart.ipynb b/matpltlib/4_bar_chart/4_bar_chart.ipynb index 201741b3..6126a315 100644 --- a/matpltlib/4_bar_chart/4_bar_chart.ipynb +++ b/matpltlib/4_bar_chart/4_bar_chart.ipynb @@ -4,7 +4,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Matplotlib Tutorial: Bar Chart

" + "

Matplotlib Tutorial: Bar Chart

" ] }, { @@ -155,7 +155,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Horizontal bar chart using barh function

" + "

Horizontal bar chart using barh function

" ] }, { @@ -189,7 +189,7 @@ "\n", "plt.yticks(xpos,company)\n", "plt.ylabel(\"Revenue(Bln)\")\n", - "plt.title('US Technolog Stocks')\n", + "plt.title('US Technology Stocks')\n", "plt.legend()" ] } diff --git a/matpltlib/5_histogram/5_histogram.ipynb b/matpltlib/5_histogram/5_histogram.ipynb index d6f63ee6..d3837753 100644 --- a/matpltlib/5_histogram/5_histogram.ipynb +++ b/matpltlib/5_histogram/5_histogram.ipynb @@ -4,7 +4,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Matplotlib Tutorial: Histogram

" + "

Matplotlib Tutorial: Histogram

" ] }, { @@ -122,7 +122,7 @@ "" ] }, diff --git a/matpltlib/6_pie_chart/6_pie_chart.ipynb b/matpltlib/6_pie_chart/6_pie_chart.ipynb index 645fb955..efac2881 100644 --- a/matpltlib/6_pie_chart/6_pie_chart.ipynb +++ b/matpltlib/6_pie_chart/6_pie_chart.ipynb @@ -6,7 +6,7 @@ "collapsed": true }, "source": [ - "

Matplotlib Tutorial: Pie Charts

" + "

Matplotlib Tutorial: Pie Charts

" ] }, { diff --git a/numpy/nditer.ipynb b/numpy/nditer.ipynb index 3d554676..2d0f4e48 100644 --- a/numpy/nditer.ipynb +++ b/numpy/nditer.ipynb @@ -4,7 +4,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Numpy tutorial: iterate numpy array using nditer

" + "

Numpy tutorial: iterate numpy array using nditer

" ] }, { @@ -38,10 +38,7 @@ "output_type": "execute_result" } ], - "source": [ - "a = np.arange(12).reshape(3,4)\n", - "a" - ] + "source": "a = np.arange(12).reshape(3, 4)\na" }, { "cell_type": "markdown", @@ -167,7 +164,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Fortan style ordering

" + "

Fortran style ordering

" ] }, { @@ -226,10 +223,7 @@ ] } ], - "source": [ - "for x in np.nditer(a, flags=['external_loop'],order='F'):\n", - " print(x)" - ] + "source": "for x in np.nditer(a, flags=['external_loop'], order='F'):\n print(x)" }, { "cell_type": "markdown", @@ -299,10 +293,7 @@ "output_type": "execute_result" } ], - "source": [ - "b = np.arange(3, 15, 4).reshape(3,1)\n", - "b" - ] + "source": "b = np.arange(3, 15, 4).reshape(3, 1)\nb" }, { "cell_type": "code", @@ -328,10 +319,7 @@ ] } ], - "source": [ - "for x, y in np.nditer([a,b]):\n", - " print (x,y)" - ] + "source": "for x, y in np.nditer([a, b]):\n print(x, y)" } ], "metadata": { @@ -355,4 +343,4 @@ }, "nbformat": 4, "nbformat_minor": 2 -} +} \ No newline at end of file diff --git a/numpy/numpy_tutorail_2.py b/numpy/numpy_tutorail_2.py deleted file mode 100644 index 4a674fa7..00000000 --- a/numpy/numpy_tutorail_2.py +++ /dev/null @@ -1,3 +0,0 @@ -import numpy as np - -a=np.array([[1,2,3],[4,5,6]]) diff --git a/numpy/numpy_tutorial.py b/numpy/numpy_tutorial.py index f92f2f85..ae816ebb 100644 --- a/numpy/numpy_tutorial.py +++ b/numpy/numpy_tutorial.py @@ -1,19 +1,16 @@ import numpy as np import time -import sys SIZE = 1000000 l1 = range(SIZE) l2 = range(SIZE) -a1=np.arange(SIZE) -a2=np.arange(SIZE) +a1 = np.arange(SIZE) +a2 = np.arange(SIZE) # python list start = time.time() -result = [(x+y) for x,y in zip(l1,l2)] -print("python list took: ",(time.time()-start)*1000) +result = [(x + y) for x, y in zip(l1, l2)] +print("python list took: ", (time.time() - start) * 1000) # numpy array -start= time.time() +start = time.time() result = a1 + a2 -print("numpy took: ", (time.time()-start)*1000) - - +print("numpy took: ", (time.time() - start) * 1000) diff --git a/numpy/numpy_tutorial_2.py b/numpy/numpy_tutorial_2.py new file mode 100644 index 00000000..900e418d --- /dev/null +++ b/numpy/numpy_tutorial_2.py @@ -0,0 +1,3 @@ +import numpy as np + +a = np.array([[1, 2, 3], [4, 5, 6]])