Talk given to the CU Boulder Computational Science and Engineering Research Group on April 20, 2017 about using NBExtensions in Jupyter Notebooks.
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 

10 KiB

A Section for TOC

Another section

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec tortor erat, faucibus in faucibus ut, mattis quis ligula. Vivamus ultricies non augue rhoncus placerat. Nulla eleifend, lacus eget fermentum tristique, nisi lectus aliquet risus, at vestibulum dolor mauris quis velit. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Suspendisse elementum sapien turpis, in gravida felis iaculis vitae. Donec sodales, erat in rutrum sollicitudin, nisl nisl finibus eros, id blandit enim diam vitae ex. Aliquam et ligula id augue pretium fringilla. Donec turpis mi, pulvinar at velit et, pretium dapibus lorem.

Yet another Section

Praesent aliquam ornare orci quis blandit. Donec pulvinar lacinia nulla at hendrerit. Morbi sed sem elementum, finibus tellus ac, vestibulum augue. In vestibulum tortor id augue molestie porta. In ut imperdiet dolor. Mauris sit amet condimentum ex, eu blandit quam. Suspendisse quis magna non ante sagittis bibendum. Etiam dictum justo et justo porta, at finibus purus aliquam. Nulla facilisi. In dolor mauris, mollis in blandit vitae, dictum non mauris. Aenean nec arcu vestibulum, maximus sem a, volutpat nisl. Vivamus dignissim ultricies justo. Praesent facilisis magna ac velit vestibulum tincidunt.

Sub-section

Sed commodo ultrices risus, sed feugiat est luctus sed. Duis neque metus, fermentum tincidunt leo in, porttitor ullamcorper nisl. Ut efficitur nibh augue, ac hendrerit velit auctor ac. Aenean aliquet felis nec dui egestas, nec ornare turpis mollis. Nullam luctus viverra fermentum. Vivamus scelerisque nulla in erat rutrum, ac luctus nibh egestas. Donec fringilla augue cursus libero sagittis gravida. In hac habitasse platea dictumst. Morbi dignissim magna vitae justo fermentum, eu fermentum magna efficitur. Sed risus sem, elementum non faucibus at, venenatis ut sem. Nulla facilisi. In diam mauris, tincidunt et velit ac, imperdiet malesuada purus. Praesent hendrerit maximus sapien, eu accumsan magna venenatis eu. Suspendisse potenti. Praesent vitae viverra tellus, at lobortis orci. Quisque eget orci eu metus venenatis ultrices ac sit amet eros.

  • Morbi eget elit non turpis faucibus condimentum at at felis.
  • Cras dapibus mauris pharetra dictum pretium.
  • Proin eget magna interdum dolor viverra auctor at eu augue.
  • Quisque faucibus sem non turpis bibendum interdum.
  • Donec fringilla elit at consectetur pulvinar.
  • Maecenas vel massa eleifend, pretium tortor vitae, porttitor ligula.

An would you like another sub-section?

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse nulla ligula, auctor non dui sed, lobortis mollis libero. Phasellus maximus quam eget libero blandit, non convallis odio vehicula. Phasellus leo sapien, congue vel sollicitudin vel, dapibus ut ipsum. Praesent et tellus nibh. Ut tristique at neque vitae viverra. Mauris quis justo sed metus luctus faucibus et non ex. Mauris suscipit, velit nec efficitur pulvinar, metus velit posuere augue, vitae scelerisque mi ex et dui.

Fusce gravida dapibus posuere. Maecenas commodo maximus urna eu facilisis. Suspendisse ultricies bibendum mauris. Aenean accumsan vulputate dui, cursus ultrices turpis malesuada a. Pellentesque aliquet felis nisi, sed aliquet augue ornare at. Cras quis purus a urna accumsan bibendum. Maecenas at turpis est.

How is you code feeling today?

In [7]:
"""
count the examine scores from https://github.com/qiwsir/StarterLearningPython/blob/master/2code/20502.py
"""
from __future__ import division

class Scorer: 
    def __init__(self):
        pass
    
    def average_score(scores):
        """
        count average score.
        """
        score_values = scores.values()
        sum_scores = sum(score_values)
        average = sum_scores/len(score_values)
        return average

    def sorted_score(scores):
        """
        count the list for max to min.
        """
        score_lst = [(scores[k],k) for k in scores]
        sort_lst = sorted(score_lst, reverse=True)
        return [(i[1], i[0]) for i in sort_lst]

    def max_score(scores):
        """
        the max scroe and the person's name.
        """
        lst = sorted_score(scores)
        max_score = lst[0][1]
        return [(i[0],i[1]) for i in lst if i[1]==max_score]

    def min_score(scores):
        """
        the min score and the person's name.
        """
        lst = sorted_score(scores)
        min_score = lst[len(lst)-1][1]
        return [(i[0],i[1]) for i in lst if i[1]==min_score]

Do you get the gist dictionary comprehensions all?

In [ ]:
# a dictionary comprehension example using lists

list_keys = ['a', 'b', 'c']
list_vals = [1, 2, 3]

{a: b for a,b in zip(list_keys, list_vals)}

Would you like some math?

You can use the normal $ and $$ to insert LaTeX math into your document to do pretty things like:

$$\boldsymbol{\beta} = (\beta_1,\beta_2,\dotsc,\beta_n)$$

But what if you want to do numbering of such pretty things?

\begin{equation} \label{eq:t} \begin{aligned} f(x) &= x^2\\ g(x) &= \exp(x) \end{aligned} \end{equation}\begin{equation} \left( \begin{array}{c} n \\ r \end{array} \right) = \frac{n!}{r!(n-r)!} \end{equation}\begin{equation} A_{m,n} = \begin{pmatrix} a_{1,1} & a_{1,2} & \cdots & a_{1,n} \\ a_{2,1} & a_{2,2} & \cdots & a_{2,n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{m,1} & a_{m,2} & \cdots & a_{m,n} \end{pmatrix} \end{equation}