使用python语言和panda,当我的if语句为真时,我如何操作一个现有的CSV单元格,使其单元格值总是加1?
>while True > if xxx = TRUE > "open existing CSV and take the value of A1 and increment by +1"
pwuypxnk1#
试试这个
import pandas as pd A = list(range(10)) B = [a%3==0 for a in A] df = pd.DataFrame({'A':A, 'B':B}) df['A+1 if B True'] = df['A'] + df['B'] * 1
1条答案
按热度按时间pwuypxnk1#
试试这个