Una libreta IPython/Jupyter es un ambiente interactivo para escribir y correr codigo de python. Es un historial completo y auto-contenido de un calculo y puede ser convertido a otros formatos para compartir con otros.
En particular es batante popular en la comunidad cientifica porque es una herramienta interactiva, iterativa para analisis de datos, visualizacion y contar historias.
Puedes combinar:
El projecto Ipython reciente se expandio en la versio 3.0 para incluir otros kerneles de computo como R, Julia, C++ y Matlab. Para mas informacion/ideas checa los links abajo de este Ipython Notebook.
Corre tu codido usando Shift-Enter o presionando el boton en la barra de herramientas arriba.
In [ ]:
print("hola bolivia")
In [ ]:
un_str = "Cuanto es 2 x 4 ?"
resultado= 2 * 4
y usarlo en otra celda
In [ ]:
print(un_str)
print(resultado)
print("Magia!")
In [ ]:
import time
time.sleep(10)
In [ ]:
a_list = [ "vaca", "taco", "gato"] #list
print(a_list)
podemos agregar elementos
In [ ]:
a_list.append("pollo") # now part of the family
a_list
In [1]:
import numpy as np
# lista de numeros del 0 a 100, en incrementos de 1
numeros = np.arange(0,100,1)
print(numeros)
y que tal arreglos vacios? Aqui creamos un vector de 5 x 1
In [2]:
array_vacio = np.zeros((5,1))
array_vacio
Out[2]:
podemos cambiar valores usando [ indice ]:
In [3]:
array_vacio[2] = 8 # manipular el tercer elemento
array_vacio
Out[3]:
y que tal arreglos de numeros aleatorios?
In [4]:
integers = np.random.randint(low=1,high=10, size=100000)
integers
Out[4]:
Tenemos muchas utilidades para trabajar con arreglos...
In [5]:
print("Sortead :",np.sort(integers))
print("Max:",np.max(integers),", Min:",np.min(integers))
print("Max at:",np.argmax(integers),", Min at:",np.argmin(integers))
print("Mean:",np.mean(integers),", Std:",np.std(integers))
In [ ]:
for i in range(2,10,2):
print(i)
print("Fin!")
In [ ]:
for i in a_list:
for j in a_list:
print i, j
print("Fin!")
un loop pero enumerado, te rergresa un indice y un elemento
In [ ]:
for index,item in enumerate(a_list):
print(index,item)
print("Done!")
In [ ]:
import random
random.sample(a_list, 2) # select 1
In [ ]:
random.sample(numeros, 10)
In [ ]:
# La definimos..
def reordenar(lista):
val=random.sample(lista,1)
return val
# la llamamos
print(reordenar(numeros))
print(reordenar(numeros))
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
Celdas se crean por default como celdas de codigo, pero se pueden cambiar.
Cell are by default created as code cells, can be but can be easily changed to text cells by cliking on the toolbar.
In text cells you can embed narrative text using Markdown, HTML code and LaTeX equations with inline dollar signs \$ *insert equation* \$ and new line as \$\$ insert equation \$\$.
For example: $$H\psi = E\psi$$
The code for this cell is:
### Text Cells: Latex & Markdown
Cell are by default created as code cells, can be but can be easily changed to text cells by cliking on the toolbar.

In text cells you can embed narrative text using [Markdown](https://guides.github.com/features/mastering-markdown/), HTML code and LaTeX equations with inline dollar signs \$ *insert equation* \$ and new line as \$\$ *insert equation* \$\$.
For example: $$H\psi = E\psi$$
In [ ]:
from IPython.display import Image
Image(filename='files/large-hadron-collider.jpg')
In [ ]:
from IPython.display import YouTubeVideo
#https://www.youtube.com/watch?v=_6uKZWnJLCM
YouTubeVideo('_6uKZWnJLCM')
In [ ]:
from IPython.display import HTML
HTML('<iframe src=http://ipython.org/ width=700 height=350></iframe>')