如何使用np.column_stack保留标签

时间:2017-10-10 07:58:38

标签: python numpy label

taxdummy=pd.get_dummies(data['TAX CLASS AT PRESENT'])
boroughdummy=pd.get_dummies(data['BOROUGH'])
x = np.array(data['LAND SQUARE FEET'])
x1= np.array(data['GROSS SQUARE FEET'])
x2= np.array(data['BLOCK'])
x3= np.array(data['LOT'])
X = np.column_stack((x,x1,x2,x3,boroughdummy,taxdummy))

X array

我想保留原始标签x='LAND SQUARE FEET' x1='GROSS SQUARE FEET'等但不是0,1,2,3 ...

1 个答案:

答案 0 :(得分:0)

如果您想拥有原始列标签,则不应使用numpy get('/login', validate, changeStuff, returnResponse ); function validate(req, res, next) { //validate logic does something then calls next() next() //just like calling changeStuff(req, res, next) } function changeStuff(req, res, next) { //changeStuff logic changes something then calls next() next() //just like calling returnResponse(req, res, next) } function returnResponse(req, res) { //will return something and that is the end of the req-res cycle //there are no more functions to call, if you try to call next() //you would get an error, because at this point next() would be //undefined res.send(req.body) } 方法。您可以使用pandas column_stack方法连接DataFrames:

concat