Question

my question seems what many people already frequently asked.

I might missed something, but most solution suggested in related thread doesn't seem to work.

My purpose is simply multiplying series of numbers and lists which I used to do.

I haven't seen such a type error before.

Following are my code:

while c1 < 95:
    c1 = c1 + 1
    a1 = []

    f1.seek(0,0)
    arrays1 = [map(float, line.split()) for line in f1]
    newa1 = [x[5:] for x in arrays1]


    a1 = newa1[c1]
    x1 = np.array(a1, float)
    x1 = np.ma.masked_array(x1,np.isnan(x1))

    xa1 = [i for i in x1 if i>=3.5 or i<=13.]

    print xa1

    p1 = 0.95*0.90*0.5*0.4*1.03*5027.*xa1^3

Because my data has many nan value, I used masked array for this code. However the result error were same whether I used original data, masked array or just ignore nan values.

If any of you have any idea, I really appreciate.

Thank you,

Isaac

Was it helpful?

Solution

p1 = xa1**3 * 0.95*0.90*0.5*0.4*1.03*5027.

you need to have your array first (maybe ... (actually I dont think this is true) ) also as mentioned ** is how you do powers in python

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top