I have a question about possibility of adding some kind of index for repeated set of values. I have a CSV file with geological profiles of few hundreds of boreholes. Each geological layer has it own numerical code e.g. sandstone - 24. Sometimes boreholes repeat oneself. In my result file I need X and Y, bottom layer value, layer thickness and numerical code of layer. If I have two or more layers of the same lithology in my profile/borehole they should have some kind of index ( 24.1 or 24.a; 24.2/24.b...). I couldn't find the way to create this index on Stackoverflow and thats why I'm asking for your help. My code looks like this:
with open('GeoPrz_WYNIKI.csv', newline='') as file:
file = csv.reader(file, delimiter=';', quotechar='|')
measurements = list(file)
transf = []
last_xyz = None
for x, y, glub, idnazw, strop, grub, seria in measurements:
strop = float(strop)
grub = float(grub)
spag = float(format((strop + grub), ".2f"))
for line in measurements:
xyz = x, y, spag
if xyz == last_xyz:
continue
if True:
last_xyz = xyz
transf.append([x, y, spag, seria])
Output looks like this:
347591.91 301467.92 19.78 1
347591.91 301467.92 106.06 24
347591.91 301467.92 118.68 25
347591.91 301467.92 120.08 24
347591.91 301467.92 274.3 27
Desired output should look like this:
347591.91 301467.92 19.78 1
347591.91 301467.92 106.06 24
347591.91 301467.92 118.68 25
347591.91 301467.92 120.08 24.1 (or 24a)
347591.91 301467.92 274.3 27
I will be really thankful for your help! Regards, Matsu.