简体   繁体   中英

Creating new column in pandas by multiplying existing column with decimal number

I'm trying to create new column in pandas with:

cars.carPowerHP = cars.carPower * 1,341

I get error:

ValueError: Length of values does not match length of index

1,341 is a 2-tuple (1, 341) , not a floating point number.

You mean

autiDF1['carPowerHP'] =  autiDF1['carPower'] * 1.341

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM