I have dataset:
| Stop_ID | On_Demand | Tarif | Heading |
|---|---|---|---|
| 1 | T100 | Station | |
| 2 | DYes | T101 | Gym |
| 3 | T101 | River |
I want to have:
| Stop_ID | On_Demand | Tarif | Heading |
|---|---|---|---|
| 1 | DNo | T100 | Station |
| 2 | DYes | T101 | Gym |
| 3 | DNo | T101 | River |
I tried:
for index, row in sm.iterrows():
if not row["On_Demand"].startswith("D"):
sm.loc[index, "Tarif":] = row["On_Demand":]
sm.loc[index, "On_Demand"] = "DNo"
but it doesnt bring any result. Any idea how can I achieve it?
sm.at[index,'Tarif'] = row['On_Demand']that is inplace of loc try if at solves the issue