Introducción a jupyter (antes i python notebook)
-
Upload
juan-rodriguez -
Category
Science
-
view
134 -
download
3
Transcript of Introducción a jupyter (antes i python notebook)
![Page 1: Introducción a jupyter (antes i python notebook)](https://reader030.fdocuments.co/reader030/viewer/2022033020/58e738fa1a28ab49038b4df9/html5/thumbnails/1.jpg)
INTRODUCCIÓN A
JUPYTER(ANTES CONOCIDO COMO IPYTHON NOTEBOOK)
POR JUAN IGNACIO RODRÍGUEZ DE LEÓN (@JILEON EN TWITTER, @EURIBATES ENTELEGRAM)
Fuentes en https://github.com/euribates/Jupyter-Intro
![Page 2: Introducción a jupyter (antes i python notebook)](https://reader030.fdocuments.co/reader030/viewer/2022033020/58e738fa1a28ab49038b4df9/html5/thumbnails/2.jpg)
SOBRE LA INSTALACIÓNNormalmente, se usa Jupyter junto a varias librerías:Numpy, Pandas, Scipy, Matplotlib, etc...
Si ya usas Python, puedes usar pip para instalarJupyter. El resto de librerías puede ser máscomplicadoSi eres nuevo, te recomiendo usar Anaconda:Instala Jupyter y un montón de librerías yacompiladas, super sencillo y válido paraMac/Windows/Linux
keywords: Install Anaconda
![Page 3: Introducción a jupyter (antes i python notebook)](https://reader030.fdocuments.co/reader030/viewer/2022033020/58e738fa1a28ab49038b4df9/html5/thumbnails/3.jpg)
EVOLUCIÓN HISTÓRICAiPythoniPython notebookJupyter notebook (Language agnostic)
![Page 4: Introducción a jupyter (antes i python notebook)](https://reader030.fdocuments.co/reader030/viewer/2022033020/58e738fa1a28ab49038b4df9/html5/thumbnails/4.jpg)
ARQUITECTURA DE IJUPYTERMUUUY SIMPLIFICADA
WebNotebook
iPythonTerminal
iPython Kernel
ZeroMQ
![Page 5: Introducción a jupyter (antes i python notebook)](https://reader030.fdocuments.co/reader030/viewer/2022033020/58e738fa1a28ab49038b4df9/html5/thumbnails/5.jpg)
JUPYTER SE DESVINCULA DE IPYTHONSe de�ne claramente la interfaz entre el notebook yel nucleoAhora podemos reemplazar el nucleo de iPython porotro, siempre que cumpla la misma interfaziPython sigue siendo el kernel por defecto, peropueden añadirse otros
![Page 7: Introducción a jupyter (antes i python notebook)](https://reader030.fdocuments.co/reader030/viewer/2022033020/58e738fa1a28ab49038b4df9/html5/thumbnails/7.jpg)
Y MÁS...
... muchos más: , , , , ...Lista completa en
Keywords: Jupyter kernel [Tu lenguajefavorito aquí]
RubyHaskellNode.js
Go Scala Octave Bash Rust
https://github.com/jupyter/jupyter/wiki/Jupyter-kernels
![Page 8: Introducción a jupyter (antes i python notebook)](https://reader030.fdocuments.co/reader030/viewer/2022033020/58e738fa1a28ab49038b4df9/html5/thumbnails/8.jpg)
¿QUÉ ES IPYTHON?
![Page 9: Introducción a jupyter (antes i python notebook)](https://reader030.fdocuments.co/reader030/viewer/2022033020/58e738fa1a28ab49038b4df9/html5/thumbnails/9.jpg)
IPYTHON ES PYTHON CON SUPERPODERES
![Page 10: Introducción a jupyter (antes i python notebook)](https://reader030.fdocuments.co/reader030/viewer/2022033020/58e738fa1a28ab49038b4df9/html5/thumbnails/10.jpg)
UN INTERPRETE DE PYTHON AMPLIADOPuede hacer todo lo que un interprete normal, y más:
Comandos "mágicos"Coloreado de sintaxisAutocompletado de códigoIntrospecciónMejores ayudas, documentación, debugging, etc...
![Page 11: Introducción a jupyter (antes i python notebook)](https://reader030.fdocuments.co/reader030/viewer/2022033020/58e738fa1a28ab49038b4df9/html5/thumbnails/11.jpg)
¿CÓMO LO HACE?while True: orden = espera_orden() if orden.es_especial: procesa_orden_interna(orden) else: salida = ejecuta_en_python(orden) print(salida)
![Page 12: Introducción a jupyter (antes i python notebook)](https://reader030.fdocuments.co/reader030/viewer/2022033020/58e738fa1a28ab49038b4df9/html5/thumbnails/12.jpg)
EJEMPLO DE LAS CAPACIDADES DE IPYTHON ⚙Desde la consola, escribimos: ipython
![Page 13: Introducción a jupyter (antes i python notebook)](https://reader030.fdocuments.co/reader030/viewer/2022033020/58e738fa1a28ab49038b4df9/html5/thumbnails/13.jpg)
COMANDOS MÁGICOSSon ordenes propias de iPythonSiempre empiezan por % o %%
% para ordenes que afecta una sola línea%% para ordenes que afectan a toda una celda
![Page 14: Introducción a jupyter (antes i python notebook)](https://reader030.fdocuments.co/reader030/viewer/2022033020/58e738fa1a28ab49038b4df9/html5/thumbnails/14.jpg)
(ALGUNOS) COMANDOS MÁGICOS ⚙%who y %whos muestran variables de�nidas en elespacio actual%lsmagic es una orden mágica que lista todas lasordenes mágicas disponibles%timeit y %%timeit realizan un informe deltiempo de ejecución de una línea o un fragmento decódigo
Keywords: iPython magic commands
![Page 15: Introducción a jupyter (antes i python notebook)](https://reader030.fdocuments.co/reader030/viewer/2022033020/58e738fa1a28ab49038b4df9/html5/thumbnails/15.jpg)
AYUDAS Y COMPLETADO DE SINTAXIS ⚙Pulsando TABOjo, realiza introspección de lo que tenga enmemoria.Lo que no está cargado, lo desconocePodemos pedir ayuda de cualquier comando, mágicoo de python, con ? , antes o despues
![Page 16: Introducción a jupyter (antes i python notebook)](https://reader030.fdocuments.co/reader030/viewer/2022033020/58e738fa1a28ab49038b4df9/html5/thumbnails/16.jpg)
¿QUÉ ES UN NOTEBOOK?
![Page 17: Introducción a jupyter (antes i python notebook)](https://reader030.fdocuments.co/reader030/viewer/2022033020/58e738fa1a28ab49038b4df9/html5/thumbnails/17.jpg)
UNA DEFINICIÓNCOMO CUALQUIER OTRA
Una aplicación web, que permite ejecutar código a lavez que representar texto con formato, incluyendoimágenes, diagramas y ecuaciones matemáticas de
forma integrada
![Page 18: Introducción a jupyter (antes i python notebook)](https://reader030.fdocuments.co/reader030/viewer/2022033020/58e738fa1a28ab49038b4df9/html5/thumbnails/18.jpg)
¿PARA QUÉ SIRVE?Consola Python en webRealización de análisis y estudiosInformes en vivoPanel de mandoPublicaciones interactivas
![Page 19: Introducción a jupyter (antes i python notebook)](https://reader030.fdocuments.co/reader030/viewer/2022033020/58e738fa1a28ab49038b4df9/html5/thumbnails/19.jpg)
CARACTERÍSTICAS DE LOS NOTEBOOKSFáciles de compartirAutocontenidosRepetiblesVeri�cablesModi�cables
![Page 20: Introducción a jupyter (antes i python notebook)](https://reader030.fdocuments.co/reader030/viewer/2022033020/58e738fa1a28ab49038b4df9/html5/thumbnails/20.jpg)
ARRANQUEMOS JUPYTER ⚙Desde la consola, ejecutar jupyter notebook
![Page 21: Introducción a jupyter (antes i python notebook)](https://reader030.fdocuments.co/reader030/viewer/2022033020/58e738fa1a28ab49038b4df9/html5/thumbnails/21.jpg)
CREAR UN NUEVO NOTEBOOK ⚙A la Derecha, elegimos New → Python 3
![Page 22: Introducción a jupyter (antes i python notebook)](https://reader030.fdocuments.co/reader030/viewer/2022033020/58e738fa1a28ab49038b4df9/html5/thumbnails/22.jpg)
ALGUNOS EJERCICIOS ⚙Cambiar el título del notebookVer que el cambio del nombre se re�eja en eldashboardAñadir un �chero al directorio desde el quearrancamos Jupyter, por ejemplo, en línea decomando: touch notas.mdVer que el dashboard re�eja el cambio, sin necesidadde refrescar
![Page 23: Introducción a jupyter (antes i python notebook)](https://reader030.fdocuments.co/reader030/viewer/2022033020/58e738fa1a28ab49038b4df9/html5/thumbnails/23.jpg)
ANATOMIA DE UN NOTEBOOK
![Page 24: Introducción a jupyter (antes i python notebook)](https://reader030.fdocuments.co/reader030/viewer/2022033020/58e738fa1a28ab49038b4df9/html5/thumbnails/24.jpg)
UN NOTEBOOK SE DIVIDE EN CELDASNOTEBOOK = LISTA DE CELDAS + METADATOS
![Page 25: Introducción a jupyter (antes i python notebook)](https://reader030.fdocuments.co/reader030/viewer/2022033020/58e738fa1a28ab49038b4df9/html5/thumbnails/25.jpg)
HAY VARIOS TIPOS DE CELDAS
Celda de textoCelda de códigoCelda de resultados
![Page 26: Introducción a jupyter (antes i python notebook)](https://reader030.fdocuments.co/reader030/viewer/2022033020/58e738fa1a28ab49038b4df9/html5/thumbnails/26.jpg)
CELDA DE TEXTO
Aceptan markdown, y Html, con lo que podemosdarle formato a los textos muy facilmentePodemos incluir fórmulas matemáticas usando elformato de
Keywords: Latex Markdown MathJax Jupyter
LaTex
![Page 27: Introducción a jupyter (antes i python notebook)](https://reader030.fdocuments.co/reader030/viewer/2022033020/58e738fa1a28ab49038b4df9/html5/thumbnails/27.jpg)
EJEMPLO DE CELDA DE TEXTO ⚙
Insertar texto en Markdown: negritas, itálicas, unalista...Insertar texto en Html: un párrafo, una imagen...Insertar una formula matemática
![Page 28: Introducción a jupyter (antes i python notebook)](https://reader030.fdocuments.co/reader030/viewer/2022033020/58e738fa1a28ab49038b4df9/html5/thumbnails/28.jpg)
CELDA DE CÓDIGO ⚙
Imprimir los pares hasta el 20Cargar y mostrar una imagenCrear un thumbnail de la imagen anterior y mostrarloRecortar una parte de la imagen y mostrarla
Keywords: Pillow Python Image Library
![Page 29: Introducción a jupyter (antes i python notebook)](https://reader030.fdocuments.co/reader030/viewer/2022033020/58e738fa1a28ab49038b4df9/html5/thumbnails/29.jpg)
CELDA DE RESULTADOSLo que hemos visto en los resultados anteriorJupyter reconoce tipos de datos diferentes y lospuede representarIncluir HTML es superpotente
![Page 30: Introducción a jupyter (antes i python notebook)](https://reader030.fdocuments.co/reader030/viewer/2022033020/58e738fa1a28ab49038b4df9/html5/thumbnails/30.jpg)
INCUIR UN VIDEO DE YOUTUBE ⚙Usa el comando mágico %%HTMLBusca en compartir vídeo en YouTube, luego embebGuardianes de la galaxia Vol 2 va a ser la caña
![Page 31: Introducción a jupyter (antes i python notebook)](https://reader030.fdocuments.co/reader030/viewer/2022033020/58e738fa1a28ab49038b4df9/html5/thumbnails/31.jpg)
COSAS QUE NO TENEMOS TIEMPO DE VERPERO QUE RESULTAN INTERESANTES
![Page 32: Introducción a jupyter (antes i python notebook)](https://reader030.fdocuments.co/reader030/viewer/2022033020/58e738fa1a28ab49038b4df9/html5/thumbnails/32.jpg)
TODAS LAS FANTÁSTICAS LIBRERÍAS CIENTÍFICAS YMATEMÁTICAS: NUMPY, PANDAS, MATPLOTLIB, SCIPY...
... pero no te pierdas el siguiente taller, te gustará
![Page 33: Introducción a jupyter (antes i python notebook)](https://reader030.fdocuments.co/reader030/viewer/2022033020/58e738fa1a28ab49038b4df9/html5/thumbnails/33.jpg)
COMPARTIR Y CONVERTIR A OTROS FORMATOSEl formato ipynb es el formato estandar paracompartir. Es JSON sencillo. Su estructura esmetadatos más lista de celdas. Puedes enviarlo porcorreo, hacer control de versiones, ponerlo en laweb...Convertir a Html estáticoConvertir a PDF vía LatexConvertir a Restructured TextConvertir a Python / Markdown
Keywords: nbconvert
![Page 34: Introducción a jupyter (antes i python notebook)](https://reader030.fdocuments.co/reader030/viewer/2022033020/58e738fa1a28ab49038b4df9/html5/thumbnails/34.jpg)
USO DE OTROS KERNELS (LENGUAJES)Hay para elegir
![Page 35: Introducción a jupyter (antes i python notebook)](https://reader030.fdocuments.co/reader030/viewer/2022033020/58e738fa1a28ab49038b4df9/html5/thumbnails/35.jpg)
PROCESAMIENTO EN PARALELOPodemos controlar ejecución en parelelo desde un
notebook sobre multiples maquindas. Muy interesantepara todo lo que sea BigData
Keywords: pyparellel
![Page 36: Introducción a jupyter (antes i python notebook)](https://reader030.fdocuments.co/reader030/viewer/2022033020/58e738fa1a28ab49038b4df9/html5/thumbnails/36.jpg)
ESCRIBIR NUESTROS PROPIOS KERNELSHAY DOS OPCIONES
Implementar el protocolo de comunicaciones conZeroMQ desde el lenguaje que queremos añadir
Más complicado, pero es tu lenguaje favorito. Tucomunidad puede apoyarte.
Usar un wrapper en pythonLas interfaces de comunicaciones ya estáncreadas, por lo que es más simple.Pero puede quetu lenguaje no se deje wrappear facilmente
![Page 37: Introducción a jupyter (antes i python notebook)](https://reader030.fdocuments.co/reader030/viewer/2022033020/58e738fa1a28ab49038b4df9/html5/thumbnails/37.jpg)
COMPARTIR NOTEBOOKSExiste soluciones para compartir el misno notebooksentre diferentes personas, cada uno ejecuta su propiaversion, mientras que el original se mantiene intacto
Keywords: JupyterHub
![Page 38: Introducción a jupyter (antes i python notebook)](https://reader030.fdocuments.co/reader030/viewer/2022033020/58e738fa1a28ab49038b4df9/html5/thumbnails/38.jpg)
SEGURIDADNo hemos visto nada, pero existe
![Page 39: Introducción a jupyter (antes i python notebook)](https://reader030.fdocuments.co/reader030/viewer/2022033020/58e738fa1a28ab49038b4df9/html5/thumbnails/39.jpg)
¡GRACIAS A TODOS PORASISTIR!¿PREGUNTAS?