Windows问题:无法从[datetime64 [ns]]到[int32]

时间:2018-11-24 03:00:56

标签: windows pandas pipeline

以下是该错误的相关代码:

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有关的问题吗?

0 个答案:

没有答案