This expression
df["column"].diff() != 0
Gives me a pandas series of booleans. I now would like a column df["result"] where there's the value 100 for every True value in df["column"] and 0 for every False.
I don't understand why this doesn't work:
df["result"] = 100 if df["column"].diff() != 0 else 0
I understand I'd have to use loc, but from this:
df.loc[df["column"].diff() != 0]
How do I then set the result column?