enc = OneHotEncoder() enc.fit(df[["Temperature"]]) onehotlabels = enc.transform(df[["Temperature"]]).toarray()