简体   繁体   中英

unable to read csv data using python pandas

using this print i'm getting this output

print(price_data['sellingPrice'])
#0    500
#1    300
#Name: sellingPrice, dtype: int64

print(price_data['orders'])

#0    1000
#1      12
#Name: orders, dtype: int64

sale_value=  (((price_data['sellingPrice']) * (price_data['orders'])))

#0    500000
#1      3600
#dtype: int64 sale_value

is there any way that i can get output like this

for 1st row of csv

price_data['sellingPrice']=500
price_data['orders']=100
sale_value=500000
price_data['sale_value']=price_data['sellingPrice'] * price_data['orders']

Then Just use this:-

price_data.loc[0,['sellingPrice','orders','sale_value']]

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