Skip to content

Tag: increment

Python – Reset Increment

I have a list of values in a column (A) and want to increment by 1 in column (B) until the value in A changes, however, having difficulty in my loop to reset the increment when A changes. Here is desired output: Product(A) No.(B) Apple 1 Apple 2 Apple 3 Orange 1 Orange 2 Orange 3 Orange 4 Orange 5