From 0b58fe3b96f5c170755791fc4b740771b489a09d Mon Sep 17 00:00:00 2001 From: hanhuijin <60727234+hanhuijin@users.noreply.github.com> Date: Sun, 11 Oct 2020 19:47:06 +0800 Subject: [PATCH] =?UTF-8?q?Update=2009.=20=E6=8E=92=E5=BA=8F=EF=BC=8C?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E5=92=8C=E8=AE=A1=E6=95=B0.ipynb?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../09. 排序,搜索和计数.ipynb | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/IntroductionToNumpy/task05-3天排序搜索计数及集合操作/09. 排序,搜索和计数.ipynb b/IntroductionToNumpy/task05-3天排序搜索计数及集合操作/09. 排序,搜索和计数.ipynb index 03c5587..737fb99 100644 --- a/IntroductionToNumpy/task05-3天排序搜索计数及集合操作/09. 排序,搜索和计数.ipynb +++ b/IntroductionToNumpy/task05-3天排序搜索计数及集合操作/09. 排序,搜索和计数.ipynb @@ -6,7 +6,7 @@ "source": [ "# 排序,搜索和计数\n", "## 排序\n", - "\n", + "### numpy.sort()\n", "- `numpy.sort(a[, axis=-1, kind='quicksort', order=None])` Return a sorted **copy** of an array.\n", " - axis:排序沿数组的(轴)方向,0表示按行,1表示按列,None表示展开来排序,默认为-1,表示沿最后的轴排序。\n", " - kind:排序的算法,提供了快排'quicksort'、混排'mergesort'、堆排'heapsort', 默认为‘quicksort'。\n", @@ -69,7 +69,7 @@ "\n", "\n", "如果排序后,想用元素的索引位置替代排序后的实际结果,该怎么办呢?\n", - "\n", + "### numpy.argsort()\n", "- `numpy.argsort(a[, axis=-1, kind='quicksort', order=None])` Returns the indices that would sort an array.\n", "\n", "\n", @@ -147,7 +147,7 @@ "```\n", "\n", "如何将数据按照某一指标进行排序呢?\n", - "\n", + "### numpy.lexsort()\n", "- `numpy.lexsort(keys[, axis=-1])` Perform an indirect stable sort using a sequence of keys.(使用键序列执行间接稳定排序。)\n", "\n", "- 给定多个可以在电子表格中解释为列的排序键,lexsort返回一个整数索引数组,该数组描述了按多个列排序的顺序。序列中的最后一个键用于主排序顺序,倒数第二个键用于辅助排序顺序,依此类推。keys参数必须是可以转换为相同形状的数组的对象序列。如果为keys参数提供了2D数组,则将其行解释为排序键,并根据最后一行,倒数第二行等进行排序。\n", @@ -223,7 +223,7 @@ "print(y[z])\n", "# [0 0 1 2 4 4 9]\n", "```\n", - "\n", + "### numpy.partition()\n", "- `numpy.partition(a, kth, axis=-1, kind='introselect', order=None)` Return a partitioned copy of an array.\n", "\n", "Creates a copy of the array with its elements rearranged in such a way that the value of the element in k-th position is in the position it would be in a sorted array. All elements smaller than the k-th element are moved before this element and all equal or greater are moved behind it. The ordering of the elements in the two partitions is undefined.\n", @@ -309,7 +309,7 @@ "print(z[-3])\n", "# [17 24 17]\n", "```\n", - "\n", + "### numpy.argpartition()\n", "\n", "- `numpy.argpartition(a, kth, axis=-1, kind='introselect', order=None)`\n", "\n", @@ -401,7 +401,7 @@ "\n", "---\n", "## 搜索\n", - "\n", + "### numpy.argmax()\n", "- `numpy.argmax(a[, axis=None, out=None])`Returns the indices of the maximum values along an axis.\n", "\n", "【例】\n", @@ -429,7 +429,7 @@ "print(y)\n", "# [2 3 4 0 0]\n", "```\n", - "\n", + "### numpy.argmin()\n", "- `numpy.argmin(a[, axis=None, out=None])`Returns the indices of the minimum values along an axis.\n", "\n", "\n", @@ -458,7 +458,7 @@ "print(y)\n", "# [3 1 0 2 1]\n", "```\n", - "\n", + "### numppy.nonzero()\n", "\n", "- `numppy.nonzero(a)` Return the indices of the elements that are non-zero.\n", "\n", @@ -580,7 +580,7 @@ "print(y)\n", "# [4 5 6 7 8 9]\n", "```\n", - "\n", + "### numpy.where()\n", "- `numpy.where(condition, [x=None, y=None])` Return elements chosen from `x` or `y` depending on `condition`.\n", "\n", "【例】满足条件`condition`,输出`x`,不满足输出`y`。\n", @@ -643,7 +643,7 @@ "\n", "\n", "\n", - "\n", + "### numpy.searchsorted()\n", "- `numpy.searchsorted(a, v[, side='left', sorter=None])` Find indices where elements should be inserted to maintain order.\n", " - a:一维输入数组。当`sorter`参数为`None`的时候,`a`必须为升序数组;否则,`sorter`不能为空,存放`a`中元素的`index`,用于反映`a`数组的升序排列方式。\n", " - v:插入`a`数组的值,可以为单个元素,`list`或者`ndarray`。\n", @@ -727,7 +727,7 @@ "\n", "---\n", "## 计数\n", - "\n", + "### numpy.count_nonzero()\n", "- `numpy.count_nonzero(a, axis=None)` Counts the number of non-zero values in the array a.\n", "\n", "【例】返回数组中的非0元素个数。\n",