python jupyter - ghdrako/doc_snipets GitHub Wiki

Execute notebook:

C:\Tools\Anaconda\python.exe "C:\tools\Anaconda\Scripts/ipython-script.py" notebook
  • Shif-Enter - wykonanie biezacej komorki i przejscie do nastepnej
  • Esc -zaznaczenie komorki
  • Alt-Enter - wykonanie komorki i umieszczenie pod sposdem nowej
  • Enter - wejscie do edycji komorki
  • Esc - wyjscie z edycji
  • M - change cell to markdown
nr komorki 
in[nr komorki]
in[*]  oznacza ze kernel wykonuje polecenie jeszcze

Prawidlowe wyjscie z notatnika menu File->close and halt lub w notatniku shutdown wylacza notatniki wtedy na konsoli mozna Ctrl-C

??plt.title - podpowiedz  polecenia okno wyskakujace
help(plt.title) - podpowiedz w notbooku skladni polecenia
%matplotlib inline  - obrazki generowana w notatniku
% - magic sign
Zapisanie z poziomu nootbooka do pliku
%%file.data.csv
a,b,c
x,y,z

Magic Commands in Jupyter Notebooks

Syntax Description
%ls Lists files in the current directory.
%pwd Prints the current working directory.
%cd Changes the current working directory.
%time Times the execution of a single command.
%timeit Runs a command multiple times and reports the best time.
%run <script.py> Runs an external Python script.
%matplotlib Sets up Matplotlib to work interactively.
%%writefile Writes the contents of the cell to a file.
%%capture Captures the output of the cell and stores it in a variable.
%load Loads code from an external script into the cell.
%reset Resets the namespace byremovingall variables.
%who Lists all variables in the current namespace

Captures the output of the cell and stores it in a variable. %load %reset %who Loads code from an external script into the cell. Resets the namespace byremovingall vari ables. Lists all variables in the current names pace.

  • %% - magic majacy zakres calej komorki(wszystkich polecen w komorce)
  • % - magic dotyczy tylko nastepnego polecenia
np
%%latex
kod latexowy

%%bash

%%ruby
kod ruby-ego


%lsmagic  - zwraca liste wszyskich magicow


%timeeit  - mierzy czas wykonania polecenia aby np porownac szybkosc rozwiazac
%%timeit

Jupyter Markdown

Headings
# Heading 1
# Heading 2
## Heading 2.1
## Heading 2.2
LaTeX equations  $e^{i\pi} + 1 = 0$ -> $$e^x=\sum_{i=0}^\infty \frac{1}{i!}x^i$$
print "Hello World"
```
⚠️ **GitHub.com Fallback** ⚠️