a = 3
b = 4
a + b
if b > a:
print "b is bigger than a"
for i in range(10):
print "Iteration number " + str(i)
Open the ipython console
import numpy
a = numpy.ones((20,10)) -> 20x10 array filled with 1
a * 23 -> 20x10 array filled with 23
a + 1 -> 20x10 array filled with 2
a.sum() -> 200
a[3:6,4:8] = 2 -> Fills the selected cells with 2
a[[2,3],[4,4]] -> Returns the selected cells
Try
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
map = Basemap()
map.drawcoastlines()
plt.show()
from scipy.interpolate import interp1d
import matplotlib.pyplot as plt
x = np.linspace(0, 10, 10)
y = np.cos(-x**2/8.0)
f = interp1d(x, y)
f2 = interp1d(x, y, kind='cubic')
xnew = np.linspace(0, 10, 40)
plt.plot(x,y,'o',xnew,f(xnew),'-', xnew, f2(xnew),'--')
plt.legend(['data', 'linear', 'cubic'], loc='best')
plt.show()
/
#