author | Madhusudan.C.S <madhusudancs@gmail.com> |
Tue, 29 Dec 2009 19:02:01 +0530 | |
changeset 333 | 25b18b51be41 |
parent 296 | 2d08c45681a1 |
child 330 | 46533051b9d3 |
permissions | -rw-r--r-- |
115 | 1 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
142
57e0f0fd3317
Made usage of FOSSEE consistent, in comments also.
Puneeth Chaganti <punchagan@fossee.in>
parents:
137
diff
changeset
|
2 |
%Tutorial slides on Python. |
115 | 3 |
% |
142
57e0f0fd3317
Made usage of FOSSEE consistent, in comments also.
Puneeth Chaganti <punchagan@fossee.in>
parents:
137
diff
changeset
|
4 |
% Author: FOSSEE |
57e0f0fd3317
Made usage of FOSSEE consistent, in comments also.
Puneeth Chaganti <punchagan@fossee.in>
parents:
137
diff
changeset
|
5 |
% Copyright (c) 2009, FOSSEE, IIT Bombay |
115 | 6 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
7 |
||
8 |
\documentclass[14pt,compress]{beamer} |
|
9 |
%\documentclass[draft]{beamer} |
|
10 |
%\documentclass[compress,handout]{beamer} |
|
11 |
%\usepackage{pgfpages} |
|
12 |
%\pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm] |
|
13 |
||
14 |
% Modified from: generic-ornate-15min-45min.de.tex |
|
15 |
\mode<presentation> |
|
16 |
{ |
|
17 |
\usetheme{Warsaw} |
|
239
8953675dc056
Added slide numbers.
Puneeth Chaganti <punchagan@fossee.in>
parents:
229
diff
changeset
|
18 |
\useoutertheme{infolines} |
115 | 19 |
\setbeamercovered{transparent} |
20 |
} |
|
21 |
||
22 |
\usepackage[english]{babel} |
|
23 |
\usepackage[latin1]{inputenc} |
|
24 |
%\usepackage{times} |
|
25 |
\usepackage[T1]{fontenc} |
|
26 |
||
27 |
% Taken from Fernando's slides. |
|
28 |
\usepackage{ae,aecompl} |
|
29 |
\usepackage{mathpazo,courier,euler} |
|
30 |
\usepackage[scaled=.95]{helvet} |
|
116
cb91f43d2cbb
Added Least Square Fitting to Session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
115
diff
changeset
|
31 |
\usepackage{amsmath} |
115 | 32 |
|
33 |
\definecolor{darkgreen}{rgb}{0,0.5,0} |
|
34 |
||
35 |
\usepackage{listings} |
|
36 |
\lstset{language=Python, |
|
37 |
basicstyle=\ttfamily\bfseries, |
|
38 |
commentstyle=\color{red}\itshape, |
|
39 |
stringstyle=\color{darkgreen}, |
|
40 |
showstringspaces=false, |
|
41 |
keywordstyle=\color{blue}\bfseries} |
|
42 |
||
43 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
44 |
% Macros |
|
45 |
\setbeamercolor{emphbar}{bg=blue!20, fg=black} |
|
46 |
\newcommand{\emphbar}[1] |
|
47 |
{\begin{beamercolorbox}[rounded=true]{emphbar} |
|
48 |
{#1} |
|
49 |
\end{beamercolorbox} |
|
50 |
} |
|
51 |
\newcounter{time} |
|
52 |
\setcounter{time}{0} |
|
53 |
\newcommand{\inctime}[1]{\addtocounter{time}{#1}{\tiny \thetime\ m}} |
|
54 |
||
55 |
\newcommand{\typ}[1]{\lstinline{#1}} |
|
56 |
||
57 |
\newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}} } |
|
58 |
||
59 |
%%% This is from Fernando's setup. |
|
60 |
% \usepackage{color} |
|
61 |
% \definecolor{orange}{cmyk}{0,0.4,0.8,0.2} |
|
62 |
% % Use and configure listings package for nicely formatted code |
|
63 |
% \usepackage{listings} |
|
64 |
% \lstset{ |
|
65 |
% language=Python, |
|
66 |
% basicstyle=\small\ttfamily, |
|
67 |
% commentstyle=\ttfamily\color{blue}, |
|
68 |
% stringstyle=\ttfamily\color{orange}, |
|
69 |
% showstringspaces=false, |
|
70 |
% breaklines=true, |
|
71 |
% postbreak = \space\dots |
|
72 |
% } |
|
73 |
||
74 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
75 |
% Title page |
|
240
5a96cf81bdc5
Changed titles of Day1 slides.
Puneeth Chaganti <punchagan@fossee.in>
parents:
239
diff
changeset
|
76 |
\title[Statistics]{Python for Science and Engg: Statistics} |
115 | 77 |
|
78 |
\author[FOSSEE] {FOSSEE} |
|
79 |
||
80 |
\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay} |
|
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
81 |
|
286
ac457f7d1702
Changed dates in day1 slides.
Puneeth Chaganti <punchagan@fossee.in>
parents:
281
diff
changeset
|
82 |
\date[] {7 November, 2009\\Day 1, Session 3} |
115 | 83 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
84 |
||
85 |
%\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo} |
|
86 |
%\logo{\pgfuseimage{iitmlogo}} |
|
87 |
||
88 |
||
89 |
%% Delete this, if you do not want the table of contents to pop up at |
|
90 |
%% the beginning of each subsection: |
|
91 |
\AtBeginSubsection[] |
|
92 |
{ |
|
93 |
\begin{frame}<beamer> |
|
94 |
\frametitle{Outline} |
|
95 |
\tableofcontents[currentsection,currentsubsection] |
|
96 |
\end{frame} |
|
97 |
} |
|
98 |
||
99 |
\AtBeginSection[] |
|
100 |
{ |
|
101 |
\begin{frame}<beamer> |
|
102 |
\frametitle{Outline} |
|
103 |
\tableofcontents[currentsection,currentsubsection] |
|
104 |
\end{frame} |
|
105 |
} |
|
106 |
||
107 |
\newcommand{\num}{\texttt{numpy}} |
|
108 |
||
109 |
||
110 |
% If you wish to uncover everything in a step-wise fashion, uncomment |
|
111 |
% the following command: |
|
112 |
%\beamerdefaultoverlayspecification{<+->} |
|
113 |
||
114 |
%\includeonlyframes{current,current1,current2,current3,current4,current5,current6} |
|
115 |
||
116 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
117 |
% DOCUMENT STARTS |
|
118 |
\begin{document} |
|
119 |
||
120 |
\begin{frame} |
|
121 |
\maketitle |
|
122 |
\end{frame} |
|
123 |
||
124 |
%% \begin{frame} |
|
125 |
%% \frametitle{Outline} |
|
126 |
%% \tableofcontents |
|
127 |
%% % You might wish to add the option [pausesections] |
|
128 |
%% \end{frame} |
|
129 |
||
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
130 |
\section{Computing mean} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
131 |
\begin{frame} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
132 |
\frametitle{Value of acceleration due to gravity?} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
133 |
\begin{itemize} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
134 |
\item We already have pendulum.txt |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
135 |
\item We know that $ T = 2\pi \sqrt{\frac{L}{g}} $ |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
136 |
\item So $ g = \frac{4 \pi^2 L}{T^2} $ |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
137 |
\item Calculate ``g'' - acceleration due to gravity for each pair of L and T |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
138 |
\item Hence calculate mean ``g'' |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
139 |
\end{itemize} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
140 |
\end{frame} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
141 |
|
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
142 |
\begin{frame}[fragile] |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
143 |
\frametitle{Acceleration due to gravity - ``g''\ldots} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
144 |
\begin{lstlisting} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
145 |
In []: G = [] |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
146 |
In []: for line in open('pendulum.txt'): |
296
2d08c45681a1
Added final changes to the slides for Calicut workshop of day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
147 |
.... point = line.split() |
2d08c45681a1
Added final changes to the slides for Calicut workshop of day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
148 |
.... l = float(point[0]) |
2d08c45681a1
Added final changes to the slides for Calicut workshop of day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
149 |
.... t = float(point[1]) |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
150 |
.... g = 4 * pi * pi * l / t * t |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
151 |
.... G.append(g) |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
152 |
\end{lstlisting} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
153 |
\end{frame} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
154 |
|
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
155 |
\begin{frame} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
156 |
\frametitle{Computing mean ``g''} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
157 |
\begin{block}{Exercise} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
158 |
Obtain the mean of ``g'' |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
159 |
\end{block} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
160 |
\end{frame} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
161 |
|
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
162 |
\begin{frame}[fragile] |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
163 |
\frametitle{Mean ``g''} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
164 |
\begin{lstlisting} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
165 |
total = 0 |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
166 |
for g in G: |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
167 |
total += g |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
168 |
|
296
2d08c45681a1
Added final changes to the slides for Calicut workshop of day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
169 |
g_mean = total / len(g) |
2d08c45681a1
Added final changes to the slides for Calicut workshop of day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
170 |
print "Mean: ", g_mean |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
171 |
\end{lstlisting} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
172 |
\end{frame} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
173 |
|
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
174 |
\begin{frame}[fragile] |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
175 |
\frametitle{Mean ``g''} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
176 |
\begin{lstlisting} |
296
2d08c45681a1
Added final changes to the slides for Calicut workshop of day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
177 |
g_mean = sum(G) / len(G) |
2d08c45681a1
Added final changes to the slides for Calicut workshop of day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
178 |
print "Mean: ", g_mean |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
179 |
\end{lstlisting} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
180 |
\end{frame} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
181 |
|
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
182 |
\begin{frame}[fragile] |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
183 |
\frametitle{Mean ``g''} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
184 |
\begin{lstlisting} |
296
2d08c45681a1
Added final changes to the slides for Calicut workshop of day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
185 |
g_mean = mean(G) |
2d08c45681a1
Added final changes to the slides for Calicut workshop of day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
186 |
print "Mean: ", g_mean |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
187 |
\end{lstlisting} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
188 |
\inctime{10} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
189 |
\end{frame} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
190 |
|
249
135062d6f91f
Fixed typos and hanging words in Session 3 day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
240
diff
changeset
|
191 |
\section{Processing voluminous data} |
120
055b199c46c2
Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
117
diff
changeset
|
192 |
\begin{frame} |
184
9efa777af2e2
Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
178
diff
changeset
|
193 |
\frametitle{More on data processing} |
9efa777af2e2
Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
178
diff
changeset
|
194 |
\begin{block}{} |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
195 |
We have a huge data file--180,000 records.\\How do we do \emph{efficient} statistical computations, i.e. find mean, median, standard deviation etc; draw pie charts? |
184
9efa777af2e2
Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
178
diff
changeset
|
196 |
\end{block} |
9efa777af2e2
Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
178
diff
changeset
|
197 |
\end{frame} |
9efa777af2e2
Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
178
diff
changeset
|
198 |
|
249
135062d6f91f
Fixed typos and hanging words in Session 3 day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
240
diff
changeset
|
199 |
\begin{frame} |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
200 |
\frametitle{Structure of the file} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
201 |
Understanding the structure of sslc1.txt |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
202 |
\begin{itemize} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
203 |
\item Each line in the file has a student's details(record) |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
204 |
\item Each record consists of fields separated by ';' |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
205 |
\end{itemize} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
206 |
\emphbar{A;015162;JENIL T P;081;060;77;41;74;333;P;;} |
120
055b199c46c2
Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
117
diff
changeset
|
207 |
\end{frame} |
055b199c46c2
Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
117
diff
changeset
|
208 |
|
055b199c46c2
Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
117
diff
changeset
|
209 |
\begin{frame} |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
210 |
\frametitle{Structure of the file \ldots} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
211 |
\emphbar{A;015163;JOSEPH RAJ S;083;042;47;AA;72;244;;;} |
120
055b199c46c2
Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
117
diff
changeset
|
212 |
Each record consists of: |
055b199c46c2
Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
117
diff
changeset
|
213 |
\begin{itemize} |
055b199c46c2
Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
117
diff
changeset
|
214 |
\item Region Code |
055b199c46c2
Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
117
diff
changeset
|
215 |
\item Roll Number |
055b199c46c2
Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
117
diff
changeset
|
216 |
\item Name |
204
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
217 |
\item Marks of 5 subjects: English, Hindi, Maths, Science, Social |
120
055b199c46c2
Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
117
diff
changeset
|
218 |
\item Total marks |
204
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
219 |
\item Pass/Fail (P/F) |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
220 |
\item Withheld (W) |
120
055b199c46c2
Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
117
diff
changeset
|
221 |
\end{itemize} |
229
5541c47bc2e8
Added sections, subsections and time estimates for session 3 day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
216
diff
changeset
|
222 |
\inctime{5} |
120
055b199c46c2
Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
117
diff
changeset
|
223 |
\end{frame} |
055b199c46c2
Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
117
diff
changeset
|
224 |
|
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
225 |
\begin{frame} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
226 |
\frametitle{Statistical Analysis: Problem statement} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
227 |
1. Read the data supplied in the file \emph{sslc1.txt} and carry out the following: |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
228 |
\begin{itemize} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
229 |
\item[a] Draw a pie chart representing proportion of students who scored more than 90\% in each region in Science. |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
230 |
\item[b] Print mean, median and standard deviation of math scores for all regions combined. |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
231 |
\end{itemize} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
232 |
\end{frame} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
233 |
|
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
234 |
\begin{frame} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
235 |
\frametitle{Problem statement: explanation} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
236 |
\emphbar{a. Draw a pie chart representing proportion of students who scored more than 90\% in each region in Science.} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
237 |
\begin{columns} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
238 |
\column{5.25\textwidth} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
239 |
\hspace*{.5in} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
240 |
\includegraphics[height=2.6in, interpolate=true]{data/science} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
241 |
\column{0.8\textwidth} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
242 |
\end{columns} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
243 |
\end{frame} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
244 |
|
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
245 |
\begin{frame} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
246 |
\frametitle{Machinery Required} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
247 |
\begin{itemize} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
248 |
\item File reading |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
249 |
\item Parsing |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
250 |
\item Dictionaries |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
251 |
\item Arrays |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
252 |
\item Statistical operations |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
253 |
\end{itemize} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
254 |
\end{frame} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
255 |
|
229
5541c47bc2e8
Added sections, subsections and time estimates for session 3 day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
216
diff
changeset
|
256 |
\subsection{Data processing} |
120
055b199c46c2
Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
117
diff
changeset
|
257 |
\begin{frame}[fragile] |
055b199c46c2
Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
117
diff
changeset
|
258 |
\frametitle{File reading and parsing \ldots} |
055b199c46c2
Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
117
diff
changeset
|
259 |
\begin{lstlisting} |
055b199c46c2
Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
117
diff
changeset
|
260 |
for record in open('sslc1.txt'): |
055b199c46c2
Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
117
diff
changeset
|
261 |
fields = record.split(';') |
055b199c46c2
Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
117
diff
changeset
|
262 |
\end{lstlisting} |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
263 |
\begin{block}{} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
264 |
\centerline{Recall pendulum example!} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
265 |
\end{block} |
120
055b199c46c2
Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
117
diff
changeset
|
266 |
\end{frame} |
055b199c46c2
Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
117
diff
changeset
|
267 |
|
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
268 |
\subsection{Dictionaries} |
120
055b199c46c2
Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
117
diff
changeset
|
269 |
\begin{frame}[fragile] |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
270 |
\frametitle{Dictionaries: Introduction} |
120
055b199c46c2
Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
117
diff
changeset
|
271 |
\begin{itemize} |
204
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
272 |
\item lists index: 0 \ldots n |
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
273 |
\item dictionaries index using strings |
120
055b199c46c2
Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
117
diff
changeset
|
274 |
\end{itemize} |
204
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
275 |
\end{frame} |
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
276 |
|
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
277 |
\begin{frame}[fragile] |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
278 |
\frametitle{Dictionaries \ldots} |
229
5541c47bc2e8
Added sections, subsections and time estimates for session 3 day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
216
diff
changeset
|
279 |
\begin{lstlisting} |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
280 |
In []: d = {"jpg" : "image file", |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
281 |
"txt" : "text file", |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
282 |
"py" : "python code"} |
204
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
283 |
|
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
284 |
In []: d["txt"] |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
285 |
Out[]: 'text file' |
229
5541c47bc2e8
Added sections, subsections and time estimates for session 3 day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
216
diff
changeset
|
286 |
\end{lstlisting} |
120
055b199c46c2
Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
117
diff
changeset
|
287 |
\end{frame} |
055b199c46c2
Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
117
diff
changeset
|
288 |
|
055b199c46c2
Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
117
diff
changeset
|
289 |
\begin{frame}[fragile] |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
290 |
\frametitle{Dictionaries \ldots} |
229
5541c47bc2e8
Added sections, subsections and time estimates for session 3 day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
216
diff
changeset
|
291 |
\begin{lstlisting} |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
292 |
In []: "py" in d |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
293 |
Out[]: True |
204
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
294 |
|
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
295 |
In []: "cpp" in d |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
296 |
Out[]: False |
229
5541c47bc2e8
Added sections, subsections and time estimates for session 3 day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
216
diff
changeset
|
297 |
\end{lstlisting} |
204
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
298 |
\end{frame} |
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
299 |
|
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
300 |
\begin{frame}[fragile] |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
301 |
\frametitle{Dictionaries \ldots} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
302 |
\begin{lstlisting} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
303 |
In []: d.keys() |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
304 |
Out[]: ['py', 'txt', 'jpg'] |
249
135062d6f91f
Fixed typos and hanging words in Session 3 day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
240
diff
changeset
|
305 |
|
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
306 |
In []: d.values() |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
307 |
Out[]: ['python code', 'text file', |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
308 |
'image file'] |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
309 |
\end{lstlisting} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
310 |
\inctime{10} |
249
135062d6f91f
Fixed typos and hanging words in Session 3 day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
240
diff
changeset
|
311 |
\end{frame} |
135062d6f91f
Fixed typos and hanging words in Session 3 day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
240
diff
changeset
|
312 |
|
135062d6f91f
Fixed typos and hanging words in Session 3 day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
240
diff
changeset
|
313 |
\begin{frame}[fragile] |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
314 |
\frametitle{Getting back to the problem} |
229
5541c47bc2e8
Added sections, subsections and time estimates for session 3 day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
216
diff
changeset
|
315 |
Let our dictionary be: |
5541c47bc2e8
Added sections, subsections and time estimates for session 3 day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
216
diff
changeset
|
316 |
\begin{lstlisting} |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
317 |
science = {} |
229
5541c47bc2e8
Added sections, subsections and time estimates for session 3 day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
216
diff
changeset
|
318 |
\end{lstlisting} |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
319 |
\begin{itemize} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
320 |
\item Keys will be region codes |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
321 |
\item Values will be the number students who scored more than 90\% in that region |
120
055b199c46c2
Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
117
diff
changeset
|
322 |
\end{itemize} |
296
2d08c45681a1
Added final changes to the slides for Calicut workshop of day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
323 |
\begin{block}{Sample \emph{science} dictionary} |
2d08c45681a1
Added final changes to the slides for Calicut workshop of day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
324 |
\{'A': 729, 'C': 764, 'B': 1120,'E': 414, 'D': 603, 'F': 500\} |
2d08c45681a1
Added final changes to the slides for Calicut workshop of day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
325 |
\end{block} |
2d08c45681a1
Added final changes to the slides for Calicut workshop of day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
326 |
|
120
055b199c46c2
Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
117
diff
changeset
|
327 |
\end{frame} |
055b199c46c2
Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
117
diff
changeset
|
328 |
|
055b199c46c2
Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
117
diff
changeset
|
329 |
\begin{frame}[fragile] |
184
9efa777af2e2
Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
178
diff
changeset
|
330 |
\frametitle{Building parsed data \ldots} |
120
055b199c46c2
Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
117
diff
changeset
|
331 |
\begin{lstlisting} |
204
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
332 |
science = {} |
184
9efa777af2e2
Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
178
diff
changeset
|
333 |
|
120
055b199c46c2
Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
117
diff
changeset
|
334 |
for record in open('sslc1.txt'): |
184
9efa777af2e2
Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
178
diff
changeset
|
335 |
record = record.strip() |
120
055b199c46c2
Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
117
diff
changeset
|
336 |
fields = record.split(';') |
184
9efa777af2e2
Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
178
diff
changeset
|
337 |
|
9efa777af2e2
Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
178
diff
changeset
|
338 |
region_code = fields[0].strip() |
120
055b199c46c2
Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
117
diff
changeset
|
339 |
\end{lstlisting} |
055b199c46c2
Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
117
diff
changeset
|
340 |
\end{frame} |
055b199c46c2
Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
117
diff
changeset
|
341 |
|
055b199c46c2
Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
117
diff
changeset
|
342 |
\begin{frame}[fragile] |
184
9efa777af2e2
Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
178
diff
changeset
|
343 |
\frametitle{Building parsed data \ldots} |
204
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
344 |
\begin{lstlisting} |
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
345 |
if region_code not in science: |
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
346 |
science[region_code] = 0 |
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
347 |
|
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
348 |
score_str = fields[6].strip() |
204
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
349 |
|
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
350 |
score = int(score_str) if \ |
204
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
351 |
score_str != 'AA' else 0 |
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
352 |
|
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
353 |
if score > 90: |
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
354 |
science[region_code] += 1 |
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
355 |
\end{lstlisting} |
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
356 |
\end{frame} |
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
357 |
|
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
358 |
\begin{frame}[fragile] |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
359 |
\frametitle{Building parsed data \ldots} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
360 |
\begin{lstlisting} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
361 |
print science |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
362 |
print science.keys() |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
363 |
print science.values() |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
364 |
\end{lstlisting} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
365 |
\end{frame} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
366 |
|
249
135062d6f91f
Fixed typos and hanging words in Session 3 day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
240
diff
changeset
|
367 |
\subsection{Visualizing data} |
204
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
368 |
\begin{frame}[fragile] |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
369 |
\frametitle{Pie chart} |
204
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
370 |
\small |
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
371 |
\begin{lstlisting} |
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
372 |
pie(science.values(), |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
373 |
labels = science.keys()) |
204
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
374 |
title('Students scoring 90% and above |
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
375 |
in science by region') |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
376 |
savefig('science.png') |
204
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
377 |
\end{lstlisting} |
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
378 |
\begin{columns} |
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
379 |
\column{5.25\textwidth} |
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
380 |
\hspace*{1.1in} |
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
381 |
\includegraphics[height=2in, interpolate=true]{data/science} |
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
382 |
\column{0.8\textwidth} |
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
383 |
\end{columns} |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
384 |
\inctime{10} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
385 |
\end{frame} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
386 |
|
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
387 |
\begin{frame} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
388 |
\frametitle{Problem statement} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
389 |
\emphbar{b. Print mean, median and standard deviation of math scores for all regions combined.} |
204
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
390 |
\end{frame} |
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
391 |
|
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
392 |
\begin{frame}[fragile] |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
393 |
\frametitle{Building data for statistics} |
204
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
394 |
\begin{lstlisting} |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
395 |
math_scores = [] |
204
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
396 |
|
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
397 |
for record in open('sslc1.txt'): |
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
398 |
record = record.strip() |
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
399 |
fields = record.split(';') |
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
400 |
|
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
401 |
score_str = fields[5].strip() |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
402 |
score = int(score_str) if \ |
204
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
403 |
score_str != 'AA' else 0 |
125
99ca3cb18fd2
Session 3 Day 1, sslc data parsing obtaining statistics.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
120
diff
changeset
|
404 |
|
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
405 |
math_scores.append(score) |
170
36ed5cdf5fde
Reorganized the slides for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
167
diff
changeset
|
406 |
\end{lstlisting} |
36ed5cdf5fde
Reorganized the slides for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
167
diff
changeset
|
407 |
\end{frame} |
36ed5cdf5fde
Reorganized the slides for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
167
diff
changeset
|
408 |
|
249
135062d6f91f
Fixed typos and hanging words in Session 3 day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
240
diff
changeset
|
409 |
\subsection{Obtaining statistics} |
135062d6f91f
Fixed typos and hanging words in Session 3 day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
240
diff
changeset
|
410 |
\begin{frame}[fragile] |
135062d6f91f
Fixed typos and hanging words in Session 3 day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
240
diff
changeset
|
411 |
\frametitle{Obtaining statistics} |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
412 |
\begin{block}{Exercise} |
249
135062d6f91f
Fixed typos and hanging words in Session 3 day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
240
diff
changeset
|
413 |
Obtain the mean of Math scores |
135062d6f91f
Fixed typos and hanging words in Session 3 day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
240
diff
changeset
|
414 |
\end{block} |
135062d6f91f
Fixed typos and hanging words in Session 3 day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
240
diff
changeset
|
415 |
\end{frame} |
135062d6f91f
Fixed typos and hanging words in Session 3 day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
240
diff
changeset
|
416 |
|
135062d6f91f
Fixed typos and hanging words in Session 3 day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
240
diff
changeset
|
417 |
\begin{frame}[fragile] |
204
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
418 |
\frametitle{Obtaining statistics} |
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
419 |
\begin{lstlisting} |
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
420 |
print "Mean: ", mean(math_scores) |
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
421 |
|
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
422 |
print "Median: ", median(math_scores) |
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
423 |
|
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
424 |
print "Standard Deviation: ", |
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
425 |
std(math_scores) |
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
426 |
\end{lstlisting} |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
427 |
\inctime{10} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
428 |
\end{frame} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
429 |
|
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
430 |
\begin{frame}[fragile] |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
431 |
\frametitle{Obtaining statistics: efficiently!} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
432 |
\begin{lstlisting} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
433 |
math_array = array(math_scores) |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
434 |
|
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
435 |
print "Mean: ", mean(math_array) |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
436 |
|
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
437 |
print "Median: ", median(math_array) |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
438 |
|
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
439 |
print "Standard Deviation: ", |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
440 |
std(math_array) |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
441 |
\end{lstlisting} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
442 |
\inctime{5} |
204
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
443 |
\end{frame} |
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
444 |
|
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
445 |
\begin{frame}[fragile] |
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
446 |
\frametitle{What tools did we use?} |
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
447 |
\begin{itemize} |
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
448 |
\item Dictionaries for storing data |
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
449 |
\item Facilities for drawing pie charts |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
450 |
\item Efficient array manipulations |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
286
diff
changeset
|
451 |
\item Functions for statistical computations - mean, median, standard deviation |
204
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
452 |
\end{itemize} |
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
453 |
\end{frame} |
87f914f38ba1
Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
192
diff
changeset
|
454 |
|
115 | 455 |
\end{document} |