Creating shape keys using Python
You can create shapekeys directly as well as set the position of each vertex for each shapekey without using edit mode or even changing the active object. An object has a shape_key_add method that you should use instead of the operator, one advantage of the object method is that it returns the shapekey it creates, so you don't have to use an index into the array or set the active shapekey, you just work with each shapekey you create.

Each shapekey block has a data property that holds the location of each vertex in the object.

So after creating the mesh object -

verts = obj.data.vertices

sk_basis = obj.shape_key_add('Basis')
sk_basis.interpolation = 'KEY_LINEAR'
obj.data.shape_keys.use_relative = False

# Create 10 sequential deformations
for n in range(10):
    # Create new shape key
    sk = obj.shape_key_add('Deform')
    sk.interpolation = 'KEY_LINEAR'

    # position each vert
    for i in range(len(verts)):
        sk.data[i].co.z *= data[i][2]