In [2]:
pwd
Out[2]:
In [3]:
import numpy
In [4]:
numpy.loadtxt(fname='inflammation-01.csv', delimiter=',')
Out[4]:
In [5]:
weight_kg = 55
In [6]:
print(weight_kg)
In [10]:
print 'Weight in pounds:', 2.2 * weight_kg
In [19]:
weight_in_pounds = weight_kg * 2.2
In [20]:
print 'Weight in pounds:', weight_in_pounds
In [17]:
weight_kg = 57.5
print 'Weight in kg:', weight_kg
In [21]:
data = numpy.loadtxt(fname='inflammation-01.csv', delimiter=',')
In [22]:
print data
In [23]:
print type(data)
In [25]:
print data.shape
In [26]:
print 'first value in the data:', data[0, 0]
In [27]:
print 'middle value of the data:', data[30, 20]
In [28]:
print 'let us look at a slice'
print data[0:4, 0:10]
In [29]:
print data[:4, :10]
In [30]:
print data[:3, 36:]
In [31]:
answer = 4 * 2
print answer
In [32]:
doubledata = data * 2.0
In [33]:
print 'original:'
print data
print 'doubledata:'
print doubledata
In [34]:
tripledata = doubledata + data
In [35]:
print 'tripledata'
print tripledata[:3, 36:]
In [37]:
print data.mean()
Now I can write documentation together with my code
In [39]:
print data.max()
print data.min()
print data.std()
In [43]:
patient_0 = data[0, :]
print 'maximum inflammation for patient zero:', patient_0.max()
In [44]:
print 'max inflammation for patient 2:', data[2, :].max()
In [45]:
print data.mean(axis=0)
In [46]:
print data.mean(axis=0).shape
In [47]:
print data.shape
In [48]:
print data
In [49]:
print data.mean(axis=1)
In [50]:
print data.mean(axis=1).shape
In [56]:
import matplotlib.pyplot
In [61]:
%matplotlib inline
image = matplotlib.pyplot.imshow(data)
matplotlib.pyplot.show(image)
In [62]:
print data
In [63]:
print data.shape
In [65]:
print data.mean(axis=0).shape
In [66]:
print data.mean(0)
In [67]:
print data.mean(axis=0)
In [68]:
avg_inflammation = data.mean(axis=0)
In [70]:
ave_plot = matplotlib.pyplot.plot(avg_inflammation)
In [72]:
max_inflammation = data.max(axis=0)
matplotlib.pyplot.plot(max_inflammation)
Out[72]:
In [73]:
min_inflammation = data.min(axis=0)
matplotlib.pyplot.plot(min_inflammation)
Out[73]:
In [75]:
import numpy
import matplotlib.pyplot
data = numpy.loadtxt(fname='inflammation-01.csv', delimiter=',')
fig = matplotlib.pyplot.figure(figsize=(10.0, 3.0))
axes1 = fig.add_subplot(1, 3, 1)
axes2 = fig.add_subplot(1, 3, 2)
axes3 = fig.add_subplot(1, 3, 3)
axes1.set_ylabel('average')
axes1.plot(data.mean(axis=0))
axes2.set_ylabel('max')
axes2.plot(data.max(axis=0))
axes3.set_ylabel('min')
axes3.plot(data.min(axis=0))
fig.tight_layout()
matplotlib.pyplot.show(fig)
In [ ]: