CSV文件,當我跑我的Python代碼我得到這個錯誤:錯誤在Python
df = pd.DataFrame(desm)
scaler = StandardScaler()
scaler.fit(df)
ValueError Traceback (most recent call last)
<ipython-input-32-266a989a8af0> in <module>()
1 scaler = StandardScaler()
----> 2 scaler.fit(df)
C:\Users\VILLAFAÑE\Anaconda3\lib\site-packages\sklearn\preprocessing\data.py in fit(self, X, y)
555 # Reset internal state before fitting
556 self._reset()
--> 557 return self.partial_fit(X, y)
558
559 def partial_fit(self, X, y=None):
C:\Users\VILLAFAÑE\Anaconda3\lib\site-packages\sklearn\preprocessing\data.py in partial_fit(self, X, y)
578 X = check_array(X, accept_sparse=('csr', 'csc'), copy=self.copy,
579 ensure_2d=False, warn_on_dtype=True,
--> 580 estimator=self, dtype=FLOAT_DTYPES)
581
582 if X.ndim == 1:
C:\Users\VILLAFAÑE\Anaconda3\lib\site-packages\sklearn\utils\validation.py in check_array(array, accept_sparse, dtype, order, copy, force_all_finite, ensure_2d, allow_nd, ensure_min_samples, ensure_min_features, warn_on_dtype, estimator)
371 force_all_finite)
372 else:
--> 373 array = np.array(array, dtype=dtype, order=order, copy=copy)
374
375 if ensure_2d:
ValueError: could not convert string to float: 'PMP'
我的Python代碼是:
import pandas as pd
desm = pd.read_csv("G:/BASES DE DATOS/desm4.csv")
我知道那是什麼用的csv格式,但我不知道如何解決它。 請幫忙! 這裏是鏈接到csv文件,以獲取更多信息
https://drive.google.com/file/d/0B7tO-O0lx79FSnR0cVA3MDhrTG8/view?usp=sharing