From 99e6a2cfad8b60b016926eed04fec67a4c1b0cbb Mon Sep 17 00:00:00 2001 From: mogu-king <1547976000@qq.com> Date: Sun, 3 Nov 2024 04:11:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20function.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- function.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/function.py b/function.py index 7dc9248..12562a4 100644 --- a/function.py +++ b/function.py @@ -29,8 +29,8 @@ def load_data(filepath): - X (numpy array): 特征数据 - y (numpy array): 标签数据 """ - # 读取数据,指定缺失值符号为 '?' - data = np.genfromtxt(filepath, delimiter=",", dtype=str) + # 读取数据,指定分隔符为空格,缺失值符号为 '?' + data = np.genfromtxt(filepath, delimiter=" ", dtype=str) # 将 '?' 替换为 np.nan 并转换为浮点数 data[data == '?'] = np.nan