Sort data in python, such that missing data points are filled with NaNs : In the metaanalysis of a drug interference study, I am analyzing the influence on patients of drugs at several concentations at different time points.

Now for some patients, data are available for only some of the drug concentrations. 

I use a vector as follows to filter the data for each patient by available drug concentrations:

    vec_conc = ['none','1nM','10nM','100nM','1uM','10uM','100uM']

When enumerating over this "concentration vector", obviously 0 = none, 1 = 1nM, ..., 4 = 1uM, ..., 6 = 100uM.

My script so far returns arrays "influence" for each patient (e.g. below), where influence[i,0] are the above mentioned "concentration counts" and [i,1:] are the results at concentration i for the various time points.

E.g. in the following patient, data only for concentations 0, 2, 3, 5 are available:

    [[ 0.          1.          0.73475787  0.36224658  0.08579446 -0.11767365
      -0.09927562  0.17444341  0.47212111  1.00584593  1.69147789  1.89421069
       1.4718292 ]
     [ 2.          1.          0.68744907  0.38420843  0.25922927  0.04719614
       0.00841919  0.21967246  0.22183329  0.28910002  0.54637077 -0.04389335
      -1.33445338]
     [ 3.          1.          0.77854922  0.41093192  0.0713814  -0.08194854
      -0.07885753  0.1491798   0.56297583  1.0759857   1.57149366  1.37958867
       0.64409152]
     [ 5.          1.          0.09182989  0.14988215 -0.1272845   0.12154707
      -0.01194815 -0.06136953  0.18783772  0.46631855  0.78850281  0.64755372
       0.69757144]]

Now, for my later metaanalysis of all patients I would like to have the "influence" arrays  to have all NaNs included for missing concentrations.

In the above example, I would like to have

    [[ 0.          1.          0.73475787  0.36224658  0.08579446 -0.11767365
      -0.09927562  0.17444341  0.47212111  1.00584593  1.69147789  1.89421069
       1.4718292 ]
    [[ 1.          NaN          NaN         NaN        NaN         NaN
       NaN         NaN          NaN         NaN        NaN         NaN
       NaN ]
     [ 2.          1.          0.68744907  0.38420843  0.25922927  0.04719614
       0.00841919  0.21967246  0.22183329  0.28910002  0.54637077 -0.04389335
      -1.33445338]
     [ 3.          1.          0.77854922  0.41093192  0.0713814  -0.08194854
      -0.07885753  0.1491798   0.56297583  1.0759857   1.57149366  1.37958867
       0.64409152]
    [[ 4.          NaN          NaN         NaN        NaN         NaN
       NaN         NaN          NaN         NaN        NaN         NaN
       NaN ]
     [ 5.          1.          0.09182989  0.14988215 -0.1272845   0.12154707
      -0.01194815 -0.06136953  0.18783772  0.46631855  0.78850281  0.64755372
       0.69757144]]
    [[ 6.          NaN          NaN         NaN        NaN         NaN
       NaN         NaN          NaN         NaN        NaN         NaN
       NaN ]

To re-sort my influence vectors I have tried the following:

    influence_incl_missing = np.ones((len(vec_conc),len(results)+1))
    for i, conc in enumerate(vec_conc):
        if i == influence[i,0]:
            influence_incl_missing[i,:] = influence[i,:]
        else:
            influence_incl_missing[i,1:] = np.full(len(results),np.nan)
            influence_incl_missing[i,0] = i

This gives me the obvious error

    IndexError: index 4 is out of bounds for axis 0 with size 4

since len(influence) < len(vec_conc).

How can I do this in python?

Many thanks!!