我需要帮助我正在研究机器学习。我尝试使用此代码导入数据集:
# Importing the libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Importing the dataset
dataset = pd.read_csv('Rural3.csv', low_memory=False)
X = dataset.iloc[:, :-1].values
y = dataset.iloc[:, 77].values
# Splitting the dataset into the Training set and Test set
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.25, random_state = 0)
# Feature Scaling
from sklearn.preprocessing import StandardScaler
sc = StandardScaler()
X_train = sc.fit_transform(X_train)
X_test = sc.transform(X_test)
但是出现错误:ValueError: Input contains infinity or a value too large for dtype(‘float64’)
请问我该怎么办?我是 python 的新手。提前致谢。
原文由 Phd student 发布,翻译遵循 CC BY-SA 4.0 许可协议
此解决方案效果很好,修复了电源转换时的错误