i have following input:
import pandas as pd
df = pd.DataFrame(np.array([[1, "A"],[2, "A"],[3, "B"],[4, "C"],[5, "D" ],[6, "A" ],[7, "B" ],[8, "A"],
[9, "C" ],[10, "D" ],[11,"A" ],
[12, "A"],[13, "B"],[14, "B"],[15, "D" ],[16, "A" ],[17, "B" ],[18, "A" ],
[19, "C" ],[20, "D" ],[21,"A" ],
[22, "A"],[23, "A"],[24, "C"],[25, "D" ],[26, "A" ],[27, "C" ],[28, "A" ],
[29, "C" ],[30, "D" ],[31,"A" ]]),
columns=['No.', 'Value'])
This is the output:
No. Value
0 1 A
1 2 A
2 3 B
3 4 C
4 5 D
5 6 A
6 7 B
7 8 A
8 9 C
9 10 D
10 11 A
11 12 A
12 13 B
13 14 B
14 15 D
15 16 A
16 17 B
17 18 A
18 19 C
19 20 D
20 21 A
21 22 A
22 23 A
23 24 C
24 25 D
25 26 A
26 27 C
27 28 A
28 29 C
29 30 D
30 31 A
Now i want to visualize all sequences that are in the data.
The first sequence should start with the first value in the data frame and ends with upcoming value of "D". So for example the first sequence is from No. 1 to No.5 (including).
The second sequence is from No.6 till the next Value of "D", No.10. And so on.
The Dataframe has six sequences in it.
How to visualize the sequences?