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
Post a Comment