309 \frametitle{Dictionary - Building parsed data...} |
309 \frametitle{Dictionary - Building parsed data...} |
310 \begin{itemize} |
310 \begin{itemize} |
311 \item In this problem let the value of a \emph{key} be another dictionary. |
311 \item In this problem let the value of a \emph{key} be another dictionary. |
312 \item This dictionary contains: |
312 \item This dictionary contains: |
313 \begin{itemize} |
313 \begin{itemize} |
314 \item 'marks': A \emph{list} of NumPy arrays |
314 \item 'marks': A \emph{List} of \emph{Lists} containing all marks |
315 \item 'total': Total marks of each student |
315 \item 'total': A \emph{List} of total marks of each student |
316 \item 'P': Number of passes |
316 \item 'P': Number of passes |
317 \item 'F': Number of failures |
317 \item 'F': Number of failures |
318 \item 'W': Number of withdrawls |
318 \item 'W': Number of withdrawls |
319 \end{itemize} |
319 \end{itemize} |
320 \end{itemize} |
320 \end{itemize} |
360 total = 0 if score_str == 'AA' |
360 total = 0 if score_str == 'AA' |
361 or score_str == 'AAA' |
361 or score_str == 'AAA' |
362 or score_str == '' |
362 or score_str == '' |
363 else int(fields[8]) |
363 else int(fields[8]) |
364 data[fields[0]]['total'].append(total) |
364 data[fields[0]]['total'].append(total) |
365 |
365 \end{lstlisting} |
|
366 \end{frame} |
|
367 |
|
368 \begin{frame}[fragile] |
|
369 \frametitle{Dictionary - Building parsed data \ldots} |
|
370 \begin{lstlisting} |
366 pfw_key = fields[9] |
371 pfw_key = fields[9] |
367 or fields[10] |
372 or fields[10] |
368 or 'F' |
373 or 'F' |
369 data[fields[0]][pfw_key] += 1 |
374 data[fields[0]][pfw_key] += 1 |
370 \end{lstlisting} |
375 \end{lstlisting} |
371 \end{frame} |
376 \end{frame} |
372 |
377 |
373 \begin{frame}[fragile] |
378 \begin{frame}[fragile] |
374 \frametitle{Dictionary - Building parsed data \ldots} |
379 \frametitle{NumPy arrays} |
375 \begin{lstlisting} |
380 \centerline{\alert{But I lied!?!?!?}} |
376 pfw_key = fields[9] |
381 \end{frame} |
377 or fields[10] |
382 |
378 or 'F' |
383 \begin{frame}[fragile] |
379 data[fields[0]][pfw_key] += 1 |
384 \frametitle{Calculations} |
|
385 \begin{lstlisting} |
|
386 for k in data: |
|
387 data[k]['marks'] = array( |
|
388 data[k]['marks']) |
|
389 data[k]['total'] = array( |
|
390 data[k]['total']) |
380 \end{lstlisting} |
391 \end{lstlisting} |
381 \end{frame} |
392 \end{frame} |
382 |
393 |
383 \begin{frame}[fragile] |
394 \begin{frame}[fragile] |
384 \frametitle{Calculations} |
395 \frametitle{Calculations} |
385 \small |
396 \small |
386 \begin{lstlisting} |
397 \begin{lstlisting} |
387 for k in data: |
|
388 data[k]['marks'] = array(data[k]['marks']) |
|
389 data[k]['total'] = array(data[k]['total']) |
|
390 |
|
391 data[k]['avg'] = average( |
398 data[k]['avg'] = average( |
392 data[k]['total']) |
399 data[k]['total']) |
393 marks = data[k]['marks'] |
400 marks = data[k]['marks'] |
394 sub_avg = average(marks, axis=1) |
401 sub_avg = average(marks, axis=1) |
395 sub_std = sqrt(sum(square( |
402 sub_std = sqrt(sum(square( |