Skip to content
Snippets Groups Projects
Commit 55e49ae7 authored by Martin Mareš's avatar Martin Mareš
Browse files

NumPy: Pár oprav a drobností navíc

parent 81787cc7
No related branches found
No related tags found
No related merge requests found
......@@ -50,7 +50,7 @@ a.shape \cmt{(tvar pole)}
\py{%
a.size \cmt{(celkový počet prvků)}
}{%
(2, 3)
6
}
\py{%
......@@ -301,6 +301,9 @@ array([[0, 3],\\
~~~~~~~[6, 9]])
}
Pozor, řezy odkazují do původního pole!
Kopíruje se pomocí {\tt copy()}.
\end{frame}
% ----------------------------------------------------------------------
......@@ -377,6 +380,9 @@ b
array([ 0, 0, 0, 8, 0, 0, 12, 11, 9, 0])
}
Pozor, {\tt x == y} také vrací booleovský vektor.
Pro porovnání celých vektorů se hodí {\tt np.equal()} nebo {\tt np.allclose()}.
\end{frame}
% ----------------------------------------------------------------------
......
https://numpy.org/devdocs/reference/
np.array([], dtype=...)
np.zeros((3, 4))
np.ones((3, 4), dtype=...)
zeros_like
ones_like
reshape
arange
linspace
+ * @
a.sum(), min, max
a.sum(axis=0)
a.shape [pozor, není to funkce]
slices [pozor, nekopírují]
a.copy()
stretching
matplotlib.pyplot.annotate(s, xy, *args, **kwargs)
axis(\*args, \*\*kwargs)
bar
clf()
figlegend
fig = figure(figsize=...)
grid
hist ?
savefig
show
subplot
title
xlabel
ylabel
xlim
ylim
x/yscale
suptitle
text
tick_params
xkcd
random.seed
randrange
random
uniform
choice
choices(list, k=10)
shuffle(list)
sample(list, k=10)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment