【问题标题】:unable to read csv data using python pandas无法使用 python pandas 读取 csv 数据
【发布时间】:2021-06-05 09:34:30
【问题描述】:

使用这个打印我得到这个输出

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

有什么办法可以得到这样的输出

对于 csv 的第一行

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

【问题讨论】:

    标签: python python-3.x pandas dataframe csv


    【解决方案1】:
    price_data['sale_value']=price_data['sellingPrice'] * price_data['orders']
    

    然后就用这个:-

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

    【讨论】:

    • ``` sellPrice productCost ... weightSegment avgRtoCharge 0 500 350 ... 420 130 [1 rows x 10 columns]```给出这个输出
    猜你喜欢
    • 2022-11-28
    • 2021-11-30
    • 1970-01-01
    • 2019-03-18
    • 2019-11-13
    • 2016-07-30
    • 2021-12-06
    • 2014-03-26
    • 2017-06-04
    相关资源
    最近更新 更多