From 8d02022b5de57b92b28a80bd18756a27487c226d Mon Sep 17 00:00:00 2001 From: chenyibadou <163882923+chenyibadou@users.noreply.github.com> Date: Tue, 25 Jun 2024 00:36:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 优化 --- .../26.\346\240\207\345\207\206\345\214\226.py" | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git "a/226+\351\231\210\346\230\223+\346\255\246\346\261\211/26.\346\240\207\345\207\206\345\214\226.py" "b/226+\351\231\210\346\230\223+\346\255\246\346\261\211/26.\346\240\207\345\207\206\345\214\226.py" index d82942f40..24bdc8be7 100644 --- "a/226+\351\231\210\346\230\223+\346\255\246\346\261\211/26.\346\240\207\345\207\206\345\214\226.py" +++ "b/226+\351\231\210\346\230\223+\346\255\246\346\261\211/26.\346\240\207\345\207\206\345\214\226.py" @@ -41,8 +41,8 @@ def z_score(x): def draw(x): count_sum = [] for i in x: - count = x.count(i) - count_sum.append(count) + count = x.count(i) # 每个元素的个数 + count_sum.append(count) # 记录每个元素的个数 return count_sum if __name__ == '__main__': @@ -56,11 +56,7 @@ def draw(x): print("-1~1归一化:\n",b) print("零均值归一化:\n",c) - count_sum = [] - for i in x: - count = x.count(i) # 每个元素的个数 - count_sum.append(count) # 记录每个元素的个数 - + count_sum = draw(x) """" 绘图 plt.plot(x, y, fmt, **kwargs): x:表示X轴上的数据点,通常是一个列表、数组或一维序列,用于指定数据点的水平位置