How can I flag a row in a dataframe every time a column change its string value?
Ex:
Input
ColumnA ColumnB
1 Blue
2 Blue
3 Red
4 Red
5 Yellow
# diff won't work here with strings.... only works in numerical values
dataframe['changed'] = dataframe['ColumnB'].diff()
ColumnA ColumnB changed
1 Blue 0
2 Blue 0
3 Red 1
4 Red 0
5 Yellow 1
np.booltype instead of integers.np.booltakes up a single byte. I suppose you could usenp.int8but by defaultnp.int64ornp.int64(whatever a C long is on your system) is used, I believe...