Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

properly making a new column in a data frame while utilizing a boolean condition

I keep running into an issue when trying to run a Boolean expression to create a new column within a dataframe. The dataframe is a bit large and has 277 rows but i see that the actual code will only run on the first 12 rows properly. Is there anyway to tweak my expression so it properly runs on all 277 rows? The df is ran as such: df2 = pd.DataFrame(y, columns =['From', 'To', 'Scale', 'Cost']). The actual code I tried to implement to get a new column is:

df2['Timing'] = np.where(df2['Scale'] == 'Cheapest months to travel', 'true', 'false')

Comments