I have a polylinezm imported from data put together from various sources. One issue I have is that some parts of the line are missing the Z value for the vertices:

To the left, a profile graph showing the Z values along the line, to the right sketch properties showing some vertices with a dummy -9999 Z value.

I've been looking for a way to interpolate the values for the missing vertices, but have not managed to find a way. Anyone got a tip on how to do this?

OK, so here's the result (in green as 3D view):

The code I used is:

You should implement an update cursor to update the original geometry.

I have also attached the output shapefile (no attributes) for you te verify the result.