I have one big csv file, which I would like to divide into several files using a condition.
This is the excerpt of the file:
Well Zones Top Bottom
E18 A 4273714.58 412435.8397
E18 B 99966532.9 96167746.15
E18 C 48737298.05 9038801.616
E18 D 42762897.31 23612634.16
E22 A 706299.7065 0
E22 B 17639585.97 8763276.956
E22 C 7535182.443 756105.4564
E22 D 7858392.171 4359022.937
E22 A 202221.3273 0
E23 B 1876003.29 100344.7098
E23 C 39002827.89 32876455.8
E23 D 10856279.73 944615.8366
What I need to do is to create several files with, each having only one type of the "Zones" as following:
one csv file:
Well Zones Top Bottom
E18 A 4273714.58 412435.8397
E22 A 706299.7065 0
E22 A 202221.3273 0
another csv file:
Well Zones Top Bottom
E18 B 99966532.9 96167746.15
E22 B 17639585.97 8763276.956
E23 B 1876003.29 100344.7098
Surfing through the web I have only found splitting large files based on the number of rows/lines into different chunks... such as the code below:
for i,chunk in enumerate(pd.read_csv(file, chunksize=3)):