diff --git a/02-numpy/02-numpy.tex b/02-numpy/02-numpy.tex index ef8dace02b7dfadf279e4878e64750fc9b4b8c00..2ed8454f8e8f57d36c1a0e7e8f8ec6eb9ed48472 100644 --- a/02-numpy/02-numpy.tex +++ b/02-numpy/02-numpy.tex @@ -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} % ---------------------------------------------------------------------- diff --git a/02-numpy/notes b/02-numpy/notes deleted file mode 100644 index 768f3754cb7e9afc94e49ba8a4af4e14bfb7cea2..0000000000000000000000000000000000000000 --- a/02-numpy/notes +++ /dev/null @@ -1,58 +0,0 @@ -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)