day1/session5.tex
changeset 260 1f5fea506927
parent 259 bb77a470e00a
child 262 9664eddee075
child 265 ac31e2f3754e
--- a/day1/session5.tex	Thu Oct 29 00:39:33 2009 +0530
+++ b/day1/session5.tex	Fri Oct 30 15:49:51 2009 +0530
@@ -134,9 +134,8 @@
   \item Each row must have same number of values.
   \end{itemize}
 \begin{lstlisting}
-In []: data = loadtxt('pendulum.txt')
-In []: L = data[:,0]
-In []: T = data[:,1]
+In []: L, T = loadtxt('pendulum.txt', 
+                       unpack = True)
 \end{lstlisting}
 \end{frame}
 
@@ -155,11 +154,8 @@
 \end{itemize}
 \emphbar{Loading data (revisited)}
 \begin{lstlisting}
-In []: data = loadtxt('points.txt')
-In []: data.shape
-Out[]: (40, 2)
-In []: x = data[:,0]
-In []: y = data[:,1]
+In []: x, y = loadtxt('points.txt',
+                       unpack = True)
 In []: plot(x, y, '.')
 \end{lstlisting}
 \end{frame}