How to subtract a list from a list of array?

  arraylist, calculator, list, python, python-3.x

I have the following variables:

  data = ['10 20 10 36 30 33', 
          '100 50 50 30 60 27 70 24', 
          '300 1000 80 21 90 18 100 15 110 12 120',
          '30 90 130 6 140 3']
  data = [e.split() for e in data]

list of arrays of int64

  time = [np.array((time[2::2]), dtype=int) for time in data]
  concentration = [(np.array((concentration[3::2]), dtype=int)) for concentration in data]

list of float64

  C_mean = [np.mean(np.log(x)) for x in concentration]
  T_mean = [np.mean(x) for x in time]

I want to do the following:

enter image description here

So calculated this:

   a = ((np.subtract(time, T_mean)),(np.subtract(concentration, C_mean)))/(np.subtract(concentration, C_mean))

I get the following output:

                                       Colum 1
   0 row [  -6.49123184   -7.47653761   -6.7979074    -3.07121711  670.34039133 -265.40965169]
   1 row [1. 1. 1. 1. 1. 1.]


                                        Colum 2
   0 row [-4.66057051   -4.80484032   -2.53370436   13.82370265 -198.83963652]
                                    
   1 row [1. 1. 1. 1. 1.]

                                    column 3
   0 row [  -3.2910719    -3.38052422   -3.42088285   -2.39247195    5.4158155 64.96324446
         -455.85973604]
   1 row [1. 1. 1. 1. 1. 1. 1.]

I do not know why I get the [1. 1. 1. 1. 1. 1. 1. 1.] and i would like them not to appear. Furthermore, I am afraid that I have calculated the a-value wrongly.

Source: Python Questions

LEAVE A COMMENT