以下是该错误的相关代码:
class TimeToEpoch(BaseEstimator, TransformerMixin):
"""Convert a datetime column into seconds-since-epoch"""
def __init__(self, col):
self.col = col
def fit(self, X, y=None):
return self
def transform(self, X, y=None):
return X[self.col].astype(int).to_frame(self.col)
features = [
('budget', Take('budget')),
('gross', Take('gross')),
('votes', Take('votes')),
('year', Take('year')),
('genre', OHE('genre')),
('rating', OHE('rating')),
('time', TimeToEpoch('released'))
]
pipe = Pipeline([
('feat', FeatureUnion(features)),
('scale', StandardScaler())
])
trans = pipe.fit_transform(df)
基本上,这段代码试图将电影日期转换为秒(包括“ #####”或NaN)。
尽管这段代码可在用户的Mac上运行,但不适用于我的PC(我的PC)。有人可以找出与Windows有关的问题吗?