zoukankan      html  css  js  c++  java
  • Excel某列数据满足条件进行修改

    把“商品价格”列小于0.08的数值修改为0,并输出为新的文件

    import pandas as pd
    
    df = pd.read_excel("AAA.xlsx")
    df.loc[df['商品价格'] < 0.08, '商品价格'] = 0
    
    print(df)
    df.to_excel('newAAA.xlsx',index = False)

    拓展:根据某一列数据的值修改另一列的值

    df.loc[(df["Height"]<0.00244), "Height_type"] = "A"


  • 相关阅读:
    poj 2391 Ombrophobic Bovines
    混合欧拉回路poj 1637 Sightseeing tour
    POJ1149-PIGS
    C
    B
    A
    C
    B
    A
    O
  • 原文地址:https://www.cnblogs.com/HuangYJ/p/11867520.html
Copyright © 2011-2022 走看看