Category "assign"

KeyError(key) from new variable assigned to dataframe

The rates data frame I read from a csv file: rates = pd.read_csv(r'C:/Users/Owner/Documents/Research/SOMA/SomaFinal.csv', usecols=[0, 1, 2, 3],

Assign within if statement Python

Is there a simpler alternative than res = returns_value_or_none(arg) if res: do_something_with(res) or if returns_value_or_none(arg): do_something_