day1/session3.tex
author Christopher Burns <chris.d.burns@gmail.com>
Sun, 27 Jun 2010 15:16:54 -0500
branchscipy2010
changeset 423 11c942a85b3f
parent 409 4442da6bf693
permissions -rw-r--r--
REF: Reformat some of the if-blocks so it's a little more clear.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
115
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     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
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     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
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     6
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     7
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     8
\documentclass[14pt,compress]{beamer}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     9
%\documentclass[draft]{beamer}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    10
%\documentclass[compress,handout]{beamer}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    11
%\usepackage{pgfpages} 
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    12
%\pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm]
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    13
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    14
% Modified from: generic-ornate-15min-45min.de.tex
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    15
\mode<presentation>
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    16
{
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    17
  \usetheme{Warsaw}
239
8953675dc056 Added slide numbers.
Puneeth Chaganti <punchagan@fossee.in>
parents: 229
diff changeset
    18
  \useoutertheme{infolines}
115
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    19
  \setbeamercovered{transparent}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    20
}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    21
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    22
\usepackage[english]{babel}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    23
\usepackage[latin1]{inputenc}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    24
%\usepackage{times}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    25
\usepackage[T1]{fontenc}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    26
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    27
% Taken from Fernando's slides.
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    28
\usepackage{ae,aecompl}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    29
\usepackage{mathpazo,courier,euler}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    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
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    32
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    33
\definecolor{darkgreen}{rgb}{0,0.5,0}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    34
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    35
\usepackage{listings}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    36
\lstset{language=Python,
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    37
    basicstyle=\ttfamily\bfseries,
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    38
    commentstyle=\color{red}\itshape,
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    39
  stringstyle=\color{darkgreen},
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    40
  showstringspaces=false,
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    41
  keywordstyle=\color{blue}\bfseries}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    42
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    43
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    44
% Macros
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    45
\setbeamercolor{emphbar}{bg=blue!20, fg=black}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    46
\newcommand{\emphbar}[1]
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    47
{\begin{beamercolorbox}[rounded=true]{emphbar} 
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    48
      {#1}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    49
 \end{beamercolorbox}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    50
}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    51
\newcounter{time}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    52
\setcounter{time}{0}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    53
\newcommand{\inctime}[1]{\addtocounter{time}{#1}{\tiny \thetime\ m}}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    54
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    55
\newcommand{\typ}[1]{\lstinline{#1}}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    56
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    57
\newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}}  }
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    58
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    59
%%% This is from Fernando's setup.
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    60
% \usepackage{color}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    61
% \definecolor{orange}{cmyk}{0,0.4,0.8,0.2}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    62
% % Use and configure listings package for nicely formatted code
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    63
% \usepackage{listings}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    64
% \lstset{
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    65
%    language=Python,
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    66
%    basicstyle=\small\ttfamily,
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    67
%    commentstyle=\ttfamily\color{blue},
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    68
%    stringstyle=\ttfamily\color{orange},
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    69
%    showstringspaces=false,
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    70
%    breaklines=true,
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    71
%    postbreak = \space\dots
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    72
% }
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    73
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    74
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    75
% Title page
409
4442da6bf693 ENH: Minor cleanup. Also added slide to introduce IPython's %timeit and
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
    76
\title[Statistics]{Python for Science and Engg:\\ Basic data processing}
115
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    77
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    78
\author[FOSSEE] {FOSSEE}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    79
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    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
409
4442da6bf693 ENH: Minor cleanup. Also added slide to introduce IPython's %timeit and
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
    82
\date[] {SciPy 2010, Introductory tutorials,\\Day 1, Session 3}
115
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    83
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    84
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    85
%\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    86
%\logo{\pgfuseimage{iitmlogo}}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    87
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    88
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    89
%% Delete this, if you do not want the table of contents to pop up at
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    90
%% the beginning of each subsection:
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    91
\AtBeginSubsection[]
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    92
{
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    93
  \begin{frame}<beamer>
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    94
    \frametitle{Outline}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    95
    \tableofcontents[currentsection,currentsubsection]
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    96
  \end{frame}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    97
}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    98
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    99
\AtBeginSection[]
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   100
{
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   101
  \begin{frame}<beamer>
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   102
    \frametitle{Outline}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   103
    \tableofcontents[currentsection,currentsubsection]
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   104
  \end{frame}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   105
}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   106
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   107
\newcommand{\num}{\texttt{numpy}}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   108
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   109
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   110
% If you wish to uncover everything in a step-wise fashion, uncomment
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   111
% the following command: 
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   112
%\beamerdefaultoverlayspecification{<+->}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   113
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   114
%\includeonlyframes{current,current1,current2,current3,current4,current5,current6}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   115
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   116
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   117
% DOCUMENT STARTS
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   118
\begin{document}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   119
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   120
\begin{frame}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   121
  \maketitle
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   122
\end{frame}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   123
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   124
%% \begin{frame}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   125
%%   \frametitle{Outline}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   126
%%   \tableofcontents
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   127
%%   % You might wish to add the option [pausesections]
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   128
%% \end{frame}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   129
409
4442da6bf693 ENH: Minor cleanup. Also added slide to introduce IPython's %timeit and
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   130
\section{Computing the mean}
288
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}
409
4442da6bf693 ENH: Minor cleanup. Also added slide to introduce IPython's %timeit and
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   134
    \item We already have \typ{pendulum.txt}
288
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}  $
409
4442da6bf693 ENH: Minor cleanup. Also added slide to introduce IPython's %timeit and
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   137
    \item Calculate $g$ - acceleration due to gravity for each pair of
4442da6bf693 ENH: Minor cleanup. Also added slide to introduce IPython's %timeit and
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   138
        $L$ and $T$
4442da6bf693 ENH: Minor cleanup. Also added slide to introduce IPython's %timeit and
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   139
    \item Hence calculate mean $g$
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   140
  \end{itemize}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   141
\end{frame}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   142
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   143
\begin{frame}[fragile]
409
4442da6bf693 ENH: Minor cleanup. Also added slide to introduce IPython's %timeit and
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   144
  \frametitle{Acceleration due to gravity - $g$\ldots}
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   145
  \begin{lstlisting}
359
cb17c87b090e Fixed errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 358
diff changeset
   146
In []: g_list = []
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   147
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
   148
  ....     point = line.split()
382
41c34770d63a Updated sessions of day 1 with the corrections from GRD.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 379
diff changeset
   149
  ....     L = float(point[0])
296
2d08c45681a1 Added final changes to the slides for Calicut workshop of day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   150
  ....     t = float(point[1])
382
41c34770d63a Updated sessions of day 1 with the corrections from GRD.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 379
diff changeset
   151
  ....     g = 4 * pi * pi * L / (t * t)
359
cb17c87b090e Fixed errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 358
diff changeset
   152
  ....     g_list.append(g)
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   153
  \end{lstlisting}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   154
\end{frame}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   155
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   156
\begin{frame}[fragile]
409
4442da6bf693 ENH: Minor cleanup. Also added slide to introduce IPython's %timeit and
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   157
  \frametitle{Mean $g$ - Classical method}
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   158
  \begin{lstlisting}
358
162e3e453920 Added files to be circulated during workshops.
Puneeth Chaganti <punchagan@fossee.in>
parents: 343
diff changeset
   159
In []: total = 0
359
cb17c87b090e Fixed errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 358
diff changeset
   160
In []: for g in g_list:
358
162e3e453920 Added files to be circulated during workshops.
Puneeth Chaganti <punchagan@fossee.in>
parents: 343
diff changeset
   161
 ....:     total += g
162e3e453920 Added files to be circulated during workshops.
Puneeth Chaganti <punchagan@fossee.in>
parents: 343
diff changeset
   162
 ....:
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   163
359
cb17c87b090e Fixed errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 358
diff changeset
   164
In []: g_mean = total / len(g_list)
358
162e3e453920 Added files to be circulated during workshops.
Puneeth Chaganti <punchagan@fossee.in>
parents: 343
diff changeset
   165
In []: print 'Mean: ', g_mean
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   166
  \end{lstlisting}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   167
\end{frame}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   168
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   169
\begin{frame}[fragile]
409
4442da6bf693 ENH: Minor cleanup. Also added slide to introduce IPython's %timeit and
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   170
  \frametitle{Mean $g$ - Slightly improved method}
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   171
  \begin{lstlisting}
359
cb17c87b090e Fixed errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 358
diff changeset
   172
In []: g_mean = sum(g_list) / len(g_list)
358
162e3e453920 Added files to be circulated during workshops.
Puneeth Chaganti <punchagan@fossee.in>
parents: 343
diff changeset
   173
In []: print 'Mean: ', g_mean
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   174
  \end{lstlisting}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   175
\end{frame}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   176
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   177
\begin{frame}[fragile]
409
4442da6bf693 ENH: Minor cleanup. Also added slide to introduce IPython's %timeit and
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   178
  \frametitle{Mean $g$ - One liner}
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   179
  \begin{lstlisting}
359
cb17c87b090e Fixed errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 358
diff changeset
   180
In []: g_mean = mean(g_list)
358
162e3e453920 Added files to be circulated during workshops.
Puneeth Chaganti <punchagan@fossee.in>
parents: 343
diff changeset
   181
In []: print 'Mean: ', g_mean
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   182
  \end{lstlisting}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   183
  \inctime{10}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   184
\end{frame}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   185
249
135062d6f91f Fixed typos and hanging words in Session 3 day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 240
diff changeset
   186
\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
   187
\begin{frame}
184
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   188
  \frametitle{More on data processing}
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   189
  \begin{block}{}
409
4442da6bf693 ENH: Minor cleanup. Also added slide to introduce IPython's %timeit and
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   190
    We have a huge data file--180,000 records.\\How do we do
4442da6bf693 ENH: Minor cleanup. Also added slide to introduce IPython's %timeit and
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   191
    \emph{efficient} statistical computations, i.e. find mean, median,
4442da6bf693 ENH: Minor cleanup. Also added slide to introduce IPython's %timeit and
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   192
    standard deviation etc.;\\How do we draw pie charts?
184
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   193
  \end{block}
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   194
\end{frame}
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   195
249
135062d6f91f Fixed typos and hanging words in Session 3 day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 240
diff changeset
   196
\begin{frame}
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   197
  \frametitle{Structure of the file}
409
4442da6bf693 ENH: Minor cleanup. Also added slide to introduce IPython's %timeit and
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   198
  Understanding the structure of \typ{sslc1.txt}
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   199
  \begin{itemize}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   200
    \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
   201
    \item Each record consists of fields separated by ';'
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   202
  \end{itemize}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   203
\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
   204
\end{frame}
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   205
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   206
\begin{frame}
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   207
  \frametitle{Structure of the file \ldots}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   208
\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
   209
  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
   210
  \begin{itemize}
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   211
    \item Region Code
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   212
    \item Roll Number
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   213
    \item Name
409
4442da6bf693 ENH: Minor cleanup. Also added slide to introduce IPython's %timeit and
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   214
    \item Marks of 5 subjects: second lang, first lang., Math, Science,
4442da6bf693 ENH: Minor cleanup. Also added slide to introduce IPython's %timeit and
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   215
        Social Studies
120
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   216
    \item Total marks
204
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   217
    \item Pass/Fail (P/F)
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   218
    \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
   219
  \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
   220
  \inctime{5}
120
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   221
\end{frame}
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   222
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   223
\begin{frame}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   224
  \frametitle{Statistical Analysis: Problem statement}
409
4442da6bf693 ENH: Minor cleanup. Also added slide to introduce IPython's %timeit and
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   225
  1. Read the data supplied in the file \typ{sslc1.txt} and carry out the following:
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   226
  \begin{itemize}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   227
    \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
   228
    \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
   229
  \end{itemize}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   230
\end{frame}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   231
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   232
\begin{frame}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   233
  \frametitle{Problem statement: explanation}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   234
    \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
   235
\begin{columns}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   236
    \column{5.25\textwidth}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   237
    \hspace*{.5in}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   238
\includegraphics[height=2.6in, interpolate=true]{data/science}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   239
    \column{0.8\textwidth}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   240
\end{columns}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   241
\end{frame}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   242
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   243
\begin{frame}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   244
  \frametitle{Machinery Required}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   245
  \begin{itemize}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   246
    \item File reading
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   247
    \item Parsing
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   248
    \item Dictionaries 
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   249
    \item Arrays
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   250
    \item Statistical operations
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   251
  \end{itemize}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   252
\end{frame}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   253
229
5541c47bc2e8 Added sections, subsections and time estimates for session 3 day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 216
diff changeset
   254
\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
   255
\begin{frame}[fragile]
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   256
  \frametitle{File reading and parsing \ldots}
379
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   257
\emphbar{Reading files line by line is the same as we had done with the pendulum example.}
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   258
120
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}
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   263
\end{frame}
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   264
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   265
\subsection{Dictionaries}
120
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   266
\begin{frame}[fragile]
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   267
  \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
   268
  \begin{itemize}
379
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   269
    \item Lists index using integers\\
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   270
Recall \typ{p = [2, 3, 5, 7]} and\\
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   271
\typ{p[1]} is equal to \typ{3}
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   272
    \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
   273
  \end{itemize}
204
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   274
\end{frame}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   275
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   276
\begin{frame}[fragile]
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   277
  \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
   278
  \begin{lstlisting}
379
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   279
In []: d = {'png' : 'image file',
337
56aa2efbf7d9 Changes at scipy.in
Puneeth Chaganti <punchagan@fossee.in>
parents: 330
diff changeset
   280
      'txt' : 'text file', 
382
41c34770d63a Updated sessions of day 1 with the corrections from GRD.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 379
diff changeset
   281
      'py' : 'python code',
379
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   282
      'java': 'bad code', 
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   283
      'cpp': 'complex code'}
204
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   284
337
56aa2efbf7d9 Changes at scipy.in
Puneeth Chaganti <punchagan@fossee.in>
parents: 330
diff changeset
   285
In []: d['txt']
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   286
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
   287
  \end{lstlisting}
120
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   288
\end{frame}
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   289
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   290
\begin{frame}[fragile]
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   291
  \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
   292
  \begin{lstlisting}
337
56aa2efbf7d9 Changes at scipy.in
Puneeth Chaganti <punchagan@fossee.in>
parents: 330
diff changeset
   293
In []: 'py' in d
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   294
Out[]: True
204
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   295
379
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   296
In []: 'jpg' in d
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   297
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
   298
  \end{lstlisting}
204
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   299
\end{frame}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   300
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   301
\begin{frame}[fragile]
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   302
  \frametitle{Dictionaries \ldots}
382
41c34770d63a Updated sessions of day 1 with the corrections from GRD.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 379
diff changeset
   303
  \begin{small}
41c34770d63a Updated sessions of day 1 with the corrections from GRD.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 379
diff changeset
   304
    \begin{lstlisting}
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   305
In []: d.keys()
382
41c34770d63a Updated sessions of day 1 with the corrections from GRD.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 379
diff changeset
   306
Out[]: ['cpp', 'py', 'txt', 'java', 'png']
249
135062d6f91f Fixed typos and hanging words in Session 3 day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 240
diff changeset
   307
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   308
In []: d.values()
382
41c34770d63a Updated sessions of day 1 with the corrections from GRD.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 379
diff changeset
   309
Out[]: ['complex code', 'python code',
41c34770d63a Updated sessions of day 1 with the corrections from GRD.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 379
diff changeset
   310
        'text file', 'bad code', 
41c34770d63a Updated sessions of day 1 with the corrections from GRD.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 379
diff changeset
   311
        'image file']
41c34770d63a Updated sessions of day 1 with the corrections from GRD.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 379
diff changeset
   312
    \end{lstlisting}
41c34770d63a Updated sessions of day 1 with the corrections from GRD.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 379
diff changeset
   313
  \end{small}
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   314
  \inctime{10}
249
135062d6f91f Fixed typos and hanging words in Session 3 day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 240
diff changeset
   315
\end{frame}
135062d6f91f Fixed typos and hanging words in Session 3 day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 240
diff changeset
   316
135062d6f91f Fixed typos and hanging words in Session 3 day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 240
diff changeset
   317
\begin{frame}[fragile]
387
5e485a5d8ac4 Minor corrections post SVCE.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 385
diff changeset
   318
  \frametitle{Inserting elements into dictionary}
5e485a5d8ac4 Minor corrections post SVCE.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 385
diff changeset
   319
  \emphbar{\alert{d[key] = value}}
5e485a5d8ac4 Minor corrections post SVCE.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 385
diff changeset
   320
  \begin{lstlisting}
5e485a5d8ac4 Minor corrections post SVCE.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 385
diff changeset
   321
    In []: d['bin'] = 'binary file'
5e485a5d8ac4 Minor corrections post SVCE.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 385
diff changeset
   322
    In []: d
5e485a5d8ac4 Minor corrections post SVCE.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 385
diff changeset
   323
    Out[]: 
5e485a5d8ac4 Minor corrections post SVCE.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 385
diff changeset
   324
    {'bin': 'binary file',
5e485a5d8ac4 Minor corrections post SVCE.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 385
diff changeset
   325
     'cpp': 'complex code',
5e485a5d8ac4 Minor corrections post SVCE.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 385
diff changeset
   326
     'java': 'bad code',
5e485a5d8ac4 Minor corrections post SVCE.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 385
diff changeset
   327
     'png': 'image file',
5e485a5d8ac4 Minor corrections post SVCE.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 385
diff changeset
   328
     'py': 'python code',
5e485a5d8ac4 Minor corrections post SVCE.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 385
diff changeset
   329
     'txt': 'text file'}
5e485a5d8ac4 Minor corrections post SVCE.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 385
diff changeset
   330
  \end{lstlisting}
5e485a5d8ac4 Minor corrections post SVCE.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 385
diff changeset
   331
\end{frame}
5e485a5d8ac4 Minor corrections post SVCE.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 385
diff changeset
   332
5e485a5d8ac4 Minor corrections post SVCE.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 385
diff changeset
   333
\begin{frame}[fragile]
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   334
  \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
   335
  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
   336
  \begin{lstlisting}
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   337
science = {}
229
5541c47bc2e8 Added sections, subsections and time estimates for session 3 day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 216
diff changeset
   338
  \end{lstlisting}
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   339
\begin{itemize}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   340
    \item Keys will be region codes
373
f04eca8b2f3d Commits from NIT DGP and IITK
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 366
diff changeset
   341
    \item Values will be the number students who scored more than 90\% in that region in Science
120
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   342
  \end{itemize}
409
4442da6bf693 ENH: Minor cleanup. Also added slide to introduce IPython's %timeit and
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   343
  \begin{block}{Sample \typ{science} dictionary}
296
2d08c45681a1 Added final changes to the slides for Calicut workshop of day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   344
    \{'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
   345
  \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
   346
120
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   347
\end{frame}
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   348
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   349
\begin{frame}[fragile]
184
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   350
  \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
   351
  \begin{lstlisting}
204
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   352
science = {}
184
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   353
120
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   354
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
   355
    fields = record.split(';')
184
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   356
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   357
    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
   358
  \end{lstlisting}
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   359
\end{frame}
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   360
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   361
\begin{frame}[fragile]
184
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   362
  \frametitle{Building parsed data \ldots}
204
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   363
  \begin{lstlisting}
423
11c942a85b3f REF: Reformat some of the if-blocks so it's a little more clear.
Christopher Burns <chris.d.burns@gmail.com>
parents: 409
diff changeset
   364
    if region_code not in science:
11c942a85b3f REF: Reformat some of the if-blocks so it's a little more clear.
Christopher Burns <chris.d.burns@gmail.com>
parents: 409
diff changeset
   365
        science[region_code] = 0
204
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   366
423
11c942a85b3f REF: Reformat some of the if-blocks so it's a little more clear.
Christopher Burns <chris.d.burns@gmail.com>
parents: 409
diff changeset
   367
    score_str = fields[6].strip()
204
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   368
423
11c942a85b3f REF: Reformat some of the if-blocks so it's a little more clear.
Christopher Burns <chris.d.burns@gmail.com>
parents: 409
diff changeset
   369
    score = 0
11c942a85b3f REF: Reformat some of the if-blocks so it's a little more clear.
Christopher Burns <chris.d.burns@gmail.com>
parents: 409
diff changeset
   370
    if score_str != 'AA':
11c942a85b3f REF: Reformat some of the if-blocks so it's a little more clear.
Christopher Burns <chris.d.burns@gmail.com>
parents: 409
diff changeset
   371
        score = int(score_str)
204
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   372
423
11c942a85b3f REF: Reformat some of the if-blocks so it's a little more clear.
Christopher Burns <chris.d.burns@gmail.com>
parents: 409
diff changeset
   373
    if score > 90:
11c942a85b3f REF: Reformat some of the if-blocks so it's a little more clear.
Christopher Burns <chris.d.burns@gmail.com>
parents: 409
diff changeset
   374
        science[region_code] += 1
204
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   375
  \end{lstlisting}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   376
\end{frame}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   377
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   378
\begin{frame}[fragile]
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   379
  \frametitle{Building parsed data \ldots}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   380
  \begin{lstlisting}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   381
print science
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   382
print science.keys()
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   383
print science.values()
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   384
  \end{lstlisting}
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
249
135062d6f91f Fixed typos and hanging words in Session 3 day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 240
diff changeset
   387
\subsection{Visualizing data}
204
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   388
\begin{frame}[fragile]
379
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   389
  \frametitle{Pie Chart}
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   390
  \begin{lstlisting}
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   391
    pie(science.values())
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   392
  \end{lstlisting}
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   393
\includegraphics[height=2in, interpolate=true]{data/science_nolabel}
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   394
\end{frame}
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   395
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   396
\begin{frame}[fragile]
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   397
  \frametitle{Pie chart}
204
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   398
  \small
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   399
  \begin{lstlisting}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   400
pie(science.values(), 
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   401
    labels = science.keys())
204
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   402
title('Students scoring 90% and above 
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   403
      in science by region')
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   404
savefig('science.png')
204
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   405
  \end{lstlisting}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   406
\begin{columns}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   407
    \column{5.25\textwidth}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   408
    \hspace*{1.1in}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   409
\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
   410
    \column{0.8\textwidth}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   411
\end{columns}
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   412
  \inctime{10}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   413
\end{frame}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   414
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   415
\begin{frame}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   416
  \frametitle{Problem statement}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   417
    \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
   418
\end{frame}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   419
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   420
\begin{frame}[fragile]
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   421
  \frametitle{Building data for statistics}
204
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   422
  \begin{lstlisting}
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   423
math_scores = []
204
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   424
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   425
for record in open('sslc1.txt'):
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   426
    fields = record.split(';')
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   427
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   428
    score_str = fields[5].strip()
423
11c942a85b3f REF: Reformat some of the if-blocks so it's a little more clear.
Christopher Burns <chris.d.burns@gmail.com>
parents: 409
diff changeset
   429
    score = 0
11c942a85b3f REF: Reformat some of the if-blocks so it's a little more clear.
Christopher Burns <chris.d.burns@gmail.com>
parents: 409
diff changeset
   430
    if score_str != 'AA':
11c942a85b3f REF: Reformat some of the if-blocks so it's a little more clear.
Christopher Burns <chris.d.burns@gmail.com>
parents: 409
diff changeset
   431
        score = int(score_str)
125
99ca3cb18fd2 Session 3 Day 1, sslc data parsing obtaining statistics.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 120
diff changeset
   432
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   433
    math_scores.append(score)
170
36ed5cdf5fde Reorganized the slides for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 167
diff changeset
   434
  \end{lstlisting}
36ed5cdf5fde Reorganized the slides for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 167
diff changeset
   435
\end{frame}
36ed5cdf5fde Reorganized the slides for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 167
diff changeset
   436
249
135062d6f91f Fixed typos and hanging words in Session 3 day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 240
diff changeset
   437
\subsection{Obtaining statistics}
135062d6f91f Fixed typos and hanging words in Session 3 day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 240
diff changeset
   438
\begin{frame}[fragile]
135062d6f91f Fixed typos and hanging words in Session 3 day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 240
diff changeset
   439
  \frametitle{Obtaining statistics}
204
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   440
  \begin{lstlisting}
337
56aa2efbf7d9 Changes at scipy.in
Puneeth Chaganti <punchagan@fossee.in>
parents: 330
diff changeset
   441
print 'Mean: ', mean(math_scores)
204
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   442
337
56aa2efbf7d9 Changes at scipy.in
Puneeth Chaganti <punchagan@fossee.in>
parents: 330
diff changeset
   443
print 'Median: ', median(math_scores)
204
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   444
337
56aa2efbf7d9 Changes at scipy.in
Puneeth Chaganti <punchagan@fossee.in>
parents: 330
diff changeset
   445
print 'Standard Deviation: ',
204
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   446
              std(math_scores)
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   447
  \end{lstlisting}
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   448
  \inctime{10}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   449
\end{frame}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   450
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   451
\begin{frame}[fragile]
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   452
  \frametitle{Obtaining statistics: efficiently!}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   453
  \begin{lstlisting}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   454
math_array = array(math_scores)
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   455
337
56aa2efbf7d9 Changes at scipy.in
Puneeth Chaganti <punchagan@fossee.in>
parents: 330
diff changeset
   456
print 'Mean: ', mean(math_array)
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   457
337
56aa2efbf7d9 Changes at scipy.in
Puneeth Chaganti <punchagan@fossee.in>
parents: 330
diff changeset
   458
print 'Median: ', median(math_array)
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   459
337
56aa2efbf7d9 Changes at scipy.in
Puneeth Chaganti <punchagan@fossee.in>
parents: 330
diff changeset
   460
print 'Standard Deviation: ',
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   461
              std(math_array)
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   462
  \end{lstlisting}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   463
  \inctime{5}
204
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   464
\end{frame}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   465
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   466
\begin{frame}[fragile]
409
4442da6bf693 ENH: Minor cleanup. Also added slide to introduce IPython's %timeit and
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   467
  \frametitle{IPython tip: Timing}
4442da6bf693 ENH: Minor cleanup. Also added slide to introduce IPython's %timeit and
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   468
4442da6bf693 ENH: Minor cleanup. Also added slide to introduce IPython's %timeit and
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   469
Try the following:
4442da6bf693 ENH: Minor cleanup. Also added slide to introduce IPython's %timeit and
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   470
  \begin{lstlisting}
4442da6bf693 ENH: Minor cleanup. Also added slide to introduce IPython's %timeit and
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   471
In []: %timeit mean(math_scores)
4442da6bf693 ENH: Minor cleanup. Also added slide to introduce IPython's %timeit and
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   472
4442da6bf693 ENH: Minor cleanup. Also added slide to introduce IPython's %timeit and
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   473
In []: %timeit mean(math_array)
4442da6bf693 ENH: Minor cleanup. Also added slide to introduce IPython's %timeit and
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   474
4442da6bf693 ENH: Minor cleanup. Also added slide to introduce IPython's %timeit and
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   475
In []: %timeit?
4442da6bf693 ENH: Minor cleanup. Also added slide to introduce IPython's %timeit and
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   476
4442da6bf693 ENH: Minor cleanup. Also added slide to introduce IPython's %timeit and
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   477
  \end{lstlisting}
4442da6bf693 ENH: Minor cleanup. Also added slide to introduce IPython's %timeit and
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   478
4442da6bf693 ENH: Minor cleanup. Also added slide to introduce IPython's %timeit and
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   479
  \begin{itemize}
4442da6bf693 ENH: Minor cleanup. Also added slide to introduce IPython's %timeit and
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   480
      \item \typ{\%timeit}: accurate, many measurements
4442da6bf693 ENH: Minor cleanup. Also added slide to introduce IPython's %timeit and
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   481
      \item Can also use \typ{\%time}
4442da6bf693 ENH: Minor cleanup. Also added slide to introduce IPython's %timeit and
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   482
      \item \typ{\%time}: less accurate, one measurement 
4442da6bf693 ENH: Minor cleanup. Also added slide to introduce IPython's %timeit and
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   483
  \end{itemize}
4442da6bf693 ENH: Minor cleanup. Also added slide to introduce IPython's %timeit and
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   484
4442da6bf693 ENH: Minor cleanup. Also added slide to introduce IPython's %timeit and
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   485
  \inctime{5}
4442da6bf693 ENH: Minor cleanup. Also added slide to introduce IPython's %timeit and
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   486
\end{frame}
4442da6bf693 ENH: Minor cleanup. Also added slide to introduce IPython's %timeit and
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   487
4442da6bf693 ENH: Minor cleanup. Also added slide to introduce IPython's %timeit and
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   488
\begin{frame}[fragile]
204
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   489
  \frametitle{What tools did we use?}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   490
  \begin{itemize}
409
4442da6bf693 ENH: Minor cleanup. Also added slide to introduce IPython's %timeit and
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   491
   \item More parsing data
204
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   492
   \item Dictionaries for storing data
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   493
   \item Facilities for drawing pie charts
409
4442da6bf693 ENH: Minor cleanup. Also added slide to introduce IPython's %timeit and
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   494
   \item Functions for statistical computations - mean, median, standard deviation
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 286
diff changeset
   495
   \item Efficient array manipulations
409
4442da6bf693 ENH: Minor cleanup. Also added slide to introduce IPython's %timeit and
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   496
   \item Timing in IPython
204
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   497
  \end{itemize}
409
4442da6bf693 ENH: Minor cleanup. Also added slide to introduce IPython's %timeit and
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   498
204
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   499
\end{frame}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   500
115
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   501
\end{document}
343
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   502
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   503
%% Questions for Quiz %%
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   504
%% ------------------ %%
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   505
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   506
\begin{frame}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   507
\frametitle{\incqno }
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   508
  A sample line from a Comma Separated Values (CSV) file:\\
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   509
  \vspace*{0.2in}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   510
  \emph{Rossum, Guido, 42, 56, 34, 54}\\
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   511
  \vspace*{0.2in}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   512
  What code would you use to separate the line into fields?
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   513
\end{frame}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   514
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   515
\begin{frame}[fragile]
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   516
\frametitle{\incqno }
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   517
  \begin{lstlisting}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   518
  In []: a = [1, 2, 5, 9]
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   519
  \end{lstlisting}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   520
  How do you find the length of this list?
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   521
\end{frame}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   522
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   523
\begin{frame}[fragile]
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   524
\frametitle{\incqno }
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   525
  \begin{lstlisting}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   526
  In [1]: d = {
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   527
          'a': 1,
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   528
          'b': 2
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   529
          }
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   530
  In [2]: print d['c']
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   531
  \end{lstlisting}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   532
  What is the output?
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   533
\end{frame}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   534
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   535
\begin{frame}[fragile]
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   536
\frametitle{\incqno }
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   537
\begin{lstlisting}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   538
In []: sc = {'A': 10, 'B': 20, 
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   539
             'C': 70}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   540
\end{lstlisting}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   541
Given the above dictionary, what command will you give to plot a
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   542
pie-chart?
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   543
\end{frame}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   544
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   545
\begin{frame}[fragile]
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   546
\frametitle{\incqno }
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   547
\begin{lstlisting}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   548
In []: marks = [10, 20, 30, 50, 55, 
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   549
                75, 83] 
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   550
\end{lstlisting}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   551
Given the above marks, how will you calculate the \alert{mean} and
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   552
\alert{standard deviation}?
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   553
\end{frame}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   554
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   555
\begin{frame}[fragile]
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   556
\frametitle{\incqno }
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   557
\begin{lstlisting}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   558
In []: marks = [10, 20, 30, 50, 55, 
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   559
               75, 83] 
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   560
\end{lstlisting}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   561
How will you convert the list \texttt{marks} to an \alert{array}?
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   562
\end{frame}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   563
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   564
%% \begin{frame}[fragile]
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   565
%% \frametitle{\incqno }
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   566
%%   \begin{lstlisting}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   567
%%   for x in "abcd":
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   568
%%       print x
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   569
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   570
%%   a
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   571
%%   b
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   572
%%   c
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   573
%%   d
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   574
%%   \end{lstlisting}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   575
%%   How do you get the following output? 
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   576
%%   \begin{lstlisting}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   577
%%     0 a
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   578
%%     1 b
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   579
%%     2 c
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   580
%%     3 d
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   581
%%   \end{lstlisting}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   582
%% \end{frame}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   583