I have a pandas dataframe that contains dates, items, and 2 values. All I\'m looking to do is output another column that is the product of column A / column B if column B is
You get that using np.where
np.where
df['C'] = np.round(np.where(df['B'] > 0, df['A']/df['B'], 0), 1)
Or if you want to use loc
loc
df.loc[df['B'] > 0, 'C'] = df['A']/df['B']
and then fillna(0)
fillna(0)