I have a large csv (test.csv) with the following header columns id; type; name
and the following values:
1; A; ASW23
2; C; SDF92
3; D; SDI22
4; D; ASD00
5; C; WPE03
6; D; PPO30
7; A; WER34
8; C; FHH88
9; C; FGE45
10; A; DFQ12
11; G; WWQ89
12; C; YDT63
13; D; QTT21
The file is not ordered and I want a CSV file split every time it finds type A, keeping the same header. For example:
test_1.csv
id; type; name
1; A; ASW23
2; C; SDF92
3; D; SDI22
4; D; ASD00
5; C; WPE03
6; D; PPO30
test_2.csv
id; type; name
7; A; WER34
8; C; FHH88
9; C; FGE45
test_3.csv
id; type; name
10; A; DFQ12
11; G; WWQ89
12; C; YDT63
13; D; QTT21
I am struggling to make a python script for that, but I am failing.