I was trying to run a script which is written below. The focus is to print 'rab'.
from numpy import *
import numpy as np
import matplotlib.pyplot as plt
from scipy import interpolate
x = [64, 67, 70.459, 73, 76]
y = [0.697, 0.693, 0.694, 0.698, 0.702]
z = [0.748, 0.745, 0.747, 0.757, 0.763]
delT = 1
f = open('volume-temperature.dat', 'r')
V = []
for line in f:
parts = line.split()
if len(parts) > 1:
#print parts[1]
V.append(parts[1])
f.close()
for M in range(0,5):
T = 0+M*delT
if M == 0:
rab = np.interp(V[M], x, y)
print rab
else:
print M
The problem is while printing 'rab' I am geting this error:
return compiled_interp(x, xp, fp, left, right)
ValueError: object of too small depth for desired array
It looks some fundamental error, But as I am new in Python, so a little help would be appreciated. N.B. V[M] for M = 0 is 70.31
from numpy import *. While it can be convenient sometimes it replaces certain built-in functions likesumwith numpy's versions which behave very differently (i.e. can give the opposite results) in some circumstances.from numpy import *orimport numpya as np