--- a/day1/session3.tex Fri Mar 05 23:59:12 2010 +0530
+++ b/day1/session3.tex Mon Mar 08 20:45:33 2010 +0530
@@ -73,7 +73,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Title page
-\title[Statistics]{Python for Science and Engg: Statistics}
+\title[Statistics]{Python for Scienc and Engg: Statistics}
\author[FOSSEE] {FOSSEE}
@@ -152,15 +152,8 @@
\end{lstlisting}
\end{frame}
-\begin{frame}
- \frametitle{Computing mean ``g''}
- \begin{block}{Exercise}
- Obtain the mean of ``g''
- \end{block}
-\end{frame}
-
\begin{frame}[fragile]
- \frametitle{Mean ``g''}
+ \frametitle{Mean ``g'' - Classical method}
\begin{lstlisting}
In []: total = 0
In []: for g in g_list:
@@ -173,7 +166,7 @@
\end{frame}
\begin{frame}[fragile]
- \frametitle{Mean ``g''}
+ \frametitle{Mean ``g'' - Slightly improved method}
\begin{lstlisting}
In []: g_mean = sum(g_list) / len(g_list)
In []: print 'Mean: ', g_mean
@@ -181,7 +174,7 @@
\end{frame}
\begin{frame}[fragile]
- \frametitle{Mean ``g''}
+ \frametitle{Mean ``g'' - One liner}
\begin{lstlisting}
In []: g_mean = mean(g_list)
In []: print 'Mean: ', g_mean
@@ -215,7 +208,7 @@
\item Region Code
\item Roll Number
\item Name
- \item Marks of 5 subjects: English, Hindi, Maths, Science, Social
+ \item Marks of 5 subjects: SLang, Flang Maths, Science, Social
\item Total marks
\item Pass/Fail (P/F)
\item Withheld (W)
@@ -257,30 +250,33 @@
\subsection{Data processing}
\begin{frame}[fragile]
\frametitle{File reading and parsing \ldots}
+\emphbar{Reading files line by line is the same as we had done with the pendulum example.}
+
\begin{lstlisting}
for record in open('sslc1.txt'):
fields = record.split(';')
\end{lstlisting}
-\begin{block}{}
-\centerline{Recall pendulum example!}
-\end{block}
\end{frame}
\subsection{Dictionaries}
\begin{frame}[fragile]
\frametitle{Dictionaries: Introduction}
\begin{itemize}
- \item lists index: 0 \ldots n
- \item dictionaries index using strings
+ \item Lists index using integers\\
+Recall \typ{p = [2, 3, 5, 7]} and\\
+\typ{p[1]} is equal to \typ{3}
+ \item Dictionaries index using strings
\end{itemize}
\end{frame}
\begin{frame}[fragile]
\frametitle{Dictionaries \ldots}
\begin{lstlisting}
-In []: d = {'jpg' : 'image file',
+In []: d = {'png' : 'image file',
'txt' : 'text file',
- 'py' : 'python code'}
+ 'py' : 'python code'
+ 'java': 'bad code',
+ 'cpp': 'complex code'}
In []: d['txt']
Out[]: 'text file'
@@ -293,7 +289,7 @@
In []: 'py' in d
Out[]: True
-In []: 'cpp' in d
+In []: 'jpg' in d
Out[]: False
\end{lstlisting}
\end{frame}
@@ -366,6 +362,14 @@
\subsection{Visualizing data}
\begin{frame}[fragile]
+ \frametitle{Pie Chart}
+ \begin{lstlisting}
+ pie(science.values())
+ \end{lstlisting}
+\includegraphics[height=2in, interpolate=true]{data/science_nolabel}
+\end{frame}
+
+\begin{frame}[fragile]
\frametitle{Pie chart}
\small
\begin{lstlisting}
@@ -408,13 +412,6 @@
\subsection{Obtaining statistics}
\begin{frame}[fragile]
\frametitle{Obtaining statistics}
- \begin{block}{Exercise}
- Obtain the mean of Math scores
- \end{block}
-\end{frame}
-
-\begin{frame}[fragile]
- \frametitle{Obtaining statistics}
\begin{lstlisting}
print 'Mean: ', mean(math_scores)