Skip to content

Instantly share code, notes, and snippets.

@mewforest
Created January 15, 2019 11:34
Show Gist options
  • Save mewforest/056ded48eb5b1e350821cd6d6965580e to your computer and use it in GitHub Desktop.
Save mewforest/056ded48eb5b1e350821cd6d6965580e to your computer and use it in GitHub Desktop.
import numpy as np
# одномерный массив
x = np.array([1, 4, 5, 8], float)
print(x, '||', type(x))
# матрица
a = np.array([[1, 2, 3], [4, 5, 6]], float)
print(a)
print('Первый элемент {}, первая строка {}, первый столбик {}'.format(a[0, 0], a[0, :], a[:, 0]))
# матрица длина
print('Длина: {}'.format(len(a)))
print('Есть ли 2? {}'.format(2 in a))
# объединение
a = np.array([[1, 2], [3, 4]], float)
b = np.array([[5, 6], [7, 8]], float)
c = np.concatenate((a, b))
print(c)
# поворот
c = np.rot90(c)
print(c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment