summaryrefslogtreecommitdiff
path: root/day1/session5.tex
diff options
context:
space:
mode:
authorPuneeth Chaganti2009-10-30 15:49:51 +0530
committerPuneeth Chaganti2009-10-30 15:49:51 +0530
commit7dcedb4dc7aaa411877d6108bc0220bd41293315 (patch)
treeb665f2922cd9634ea6b911287581c6c6df8e45ca /day1/session5.tex
parentda363caede7e7f4fbdf50218e46432a94b8555c0 (diff)
downloadworkshops-7dcedb4dc7aaa411877d6108bc0220bd41293315.tar.gz
workshops-7dcedb4dc7aaa411877d6108bc0220bd41293315.tar.bz2
workshops-7dcedb4dc7aaa411877d6108bc0220bd41293315.zip
Changed loadtxt to use unpack argument.
Diffstat (limited to 'day1/session5.tex')
-rw-r--r--day1/session5.tex12
1 files changed, 4 insertions, 8 deletions
diff --git a/day1/session5.tex b/day1/session5.tex
index ac1d8b6..c7709c5 100644
--- a/day1/session5.tex
+++ b/day1/session5.tex
@@ -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 @@ In []: T = data[:,1]
\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}