kangjinwen's recent timeline updates
kangjinwen

kangjinwen

V2EX member #10465, joined on 2011-07-20 19:21:05 +08:00
  •   The specified image does not exist
    kangjinwen's recent replies
    午睡床,眼罩,耳塞。放倒半躺着的办公椅睡着,屁股麻~
    @jimmyismagic 我用另外一种本办法解决的。没想到就是这么一个参数。谢谢大佬,祝生活舒心,工作顺心!
    @jimmyismagic 大佬。又要打扰一下,按您这样操作最后求和是正常的,但是新的 cvs 文件就没有第一列数据了。就 AUS.c01 ,AUS.c02 这些。。。
    怎么能保留这一列任然可以求和?
    df["总和"] =df.apply(lambda x: x.sum(),axis=1)里可以加什么参数从第二列开始计算吗?
    @jimmyismagic 谢谢大佬。就是这样的。。万分感谢!!!
    网上 demo 运行后是这样的
    df['row_sum']=df.apply(lambda x: x.sum(),axis=1)

    print(df)
    one two three row_sum
    a 1 5 9 15
    b 2 6 10 18
    c 3 7 11 21
    d 4 8 12 24
    @jimmyismagic
    df=pd.read_csv(r'D:\1.csv')
    df["总和"] =df.apply(lambda x: x.sum(),axis=1)
    df.to_csv(r'D:\2.csv',index=False)
    是这样读取的 csv
    Dec 27, 2019
    Replied to a topic by wxsm 职场话题 不知道该说什么
    祝楼主早日康复, 也恭喜楼主能够呆在一个好公司
    更费电了,有性能损耗
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1243 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 17:32 · PVG 01:32 · LAX 10:32 · JFK 13:32
    ♥ Do have faith in what you're doing.