% Created 2011-05-26 Thu 12:31 \documentclass[presentation]{beamer} \usepackage[latin1]{inputenc} \usepackage[T1]{fontenc} \usepackage{fixltx2e} \usepackage{graphicx} \usepackage{longtable} \usepackage{float} \usepackage{wrapfig} \usepackage{soul} \usepackage{textcomp} \usepackage{marvosym} \usepackage{wasysym} \usepackage{latexsym} \usepackage{amssymb} \usepackage{hyperref} \tolerance=1000 \usepackage[english]{babel} \usepackage{ae,aecompl} \usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet} \usepackage{listings} \lstset{language=Python, basicstyle=\ttfamily\bfseries, commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen}, showstringspaces=false, keywordstyle=\color{blue}\bfseries} \providecommand{\alert}[1]{\textbf{#1}} \title{} \author{FOSSEE} \date{26 May 2011} \usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent} \begin{document} \begin{frame} \begin{center} \vspace{12pt} \textcolor{blue}{\huge Statistics} \end{center} \vspace{18pt} \begin{center} \vspace{10pt} \includegraphics[scale=0.95]{../images/fossee-logo.png}\\ \vspace{5pt} \scriptsize Developed by FOSSEE Team, IIT-Bombay. \\ \scriptsize Funded by National Mission on Education through ICT\\ \scriptsize MHRD,Govt. of India\\ \includegraphics[scale=0.30]{../images/iitb-logo.png}\\ \end{center} \end{frame} \begin{frame} \frametitle{Objectives} \label{sec-2} At the end of this tutorial,you will be able to, \begin{itemize} \item Do statistical operations in Python. \item Sum a set of numbers. \item Find their mean,median and standard deviation. \end{itemize} \end{frame} \begin{frame} \frametitle{Pre-requisite} \label{sec-3} Spoken tutorial on - \begin{itemize} \item Loading Data from files. \item Getting started with Lists. \item Accessing Pieces of Arrays. \end{itemize} \end{frame} \begin{frame} \frametitle{Data set} \label{sec-4} \begin{itemize} \item A;015163;JOSEPH RAJ S;083;042;47;00;72;244;;; \end{itemize} The following are the fields in any given line. \begin{itemize} \item Region Code which is `A' \item Roll Number 015163 \item Name JOSEPH RAJ S \item Marks of 5 subjects: -- English 083 -- Hindi 042 -- Maths 47 -- Science 35 -- Social 72 \item Total marks 244 \end{itemize} \end{frame} \begin{frame} \frametitle{Exercise 1} \label{sec-5} \begin{itemize} \item In the given file football.txt at path /home/fossee/football.txt , one column is player name,second is goals at home and third goals away. \vspace{8pt} \begin{enumerate} \item Find the total goals for each player \item Mean home and away goals \item Standard deviation of home and away goals \end{enumerate} \end{itemize} \end{frame} \begin{frame}[fragile] \frametitle{Solution 1} \label{sec-6} \lstset{language=Python} \begin{lstlisting} L=loadtxt('/home/fossee/football.txt',usecols=(1,2), delimiter=',') sum(L,1) mean(L,0) std(L,0) \end{lstlisting} \end{frame} \begin{frame} \frametitle{Summary} \label{sec-7} In this tutorial,we have learnt to - \begin{itemize} \item Do the standard statistical operations sum , mean median and standard deviation in Python. \item Combine text loading and the statistical operation to solve real world problems. \end{itemize} \end{frame} \begin{frame} \frametitle{Evaluation} \label{sec-8} \begin{enumerate} \item Given a two dimensional list,\\ two\_dimensional\_list=[[3,5,8,2,1],[4,3,6,2,1]]\\ how do we calculate the mean of each row? \vspace{8pt} \item Calcutate the median of the given list?\\ student\_marks=[74,78,56,87,91,82] \vspace{8pt} \item Suppose there is a file with 6 columns but we wish to load text only in columns 2,3,4,5. How do we specify that? \end{enumerate} \end{frame} \begin{frame} \frametitle{Solutions} \label{sec-9} \begin{enumerate} \item mean(two\_dimensional\_list,1) \vspace{12pt} \item median(student\_marks) \vspace{12pt} \item We use the parameter usecols=(2,3,4,5) \end{enumerate} \end{frame} \begin{frame} \begin{block}{} \begin{center} \textcolor{blue}{\Large THANK YOU!} \end{center} \end{block} \begin{block}{} \begin{center} For more Information, visit our website\\ \url{http://fossee.in/} \end{center} \end{block} \end{frame} \end{document}