Tôi có mã này, tôi muốn xóa cột 'dấu thời gian' khỏi tệp: u.data nhưng không thể.Đó hiển thị lỗi
"ValueError : nhãn [ 'timestamp'] không chứa trong trục" làm thế nào tôi có thể sửa chữa nó"Lỗi ValueError: nhãn ['dấu thời gian'] không có trong trục" lỗi
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
plt.rc("font", size=14)
from sklearn.linear_model import LinearRegression
from sklearn.linear_model import Ridge
from sklearn.cross_validation import KFold
from sklearn.cross_validation import train_test_split
data = pd.read_table('u.data')
data.columns=['userID', 'itemID','rating', 'timestamp']
data.drop('timestamp', axis=1)
N = len(data)
print data.shape
print list(data.columns)
print data.head(10)
Bản sao có thể có của [ValueError: labels \ ['dấu thời gian' \] không được chứa trong trục] (http://stackoverflow.com/questions/37763715/valueerror-labels-timestamp-not-contained-in-axis) – pekapa