Skip to content

Instantly share code, notes, and snippets.

@Robofied
Created February 14, 2019 16:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Robofied/68a52f983fcc7e8b38c1064d0c201963 to your computer and use it in GitHub Desktop.
Save Robofied/68a52f983fcc7e8b38c1064d0c201963 to your computer and use it in GitHub Desktop.
Numpy
import numpy as np
a = np.array([[1,2,3],[4,5,6],[7,8,9],[10,11,12]])
print(a)
#[Output]:
#[[ 1 2 3]
# [ 4 5 6]
# [ 7 8 9]
# [10 11 12]]
# It will return the no. of axes so here 2 because it has rows and columns
print(a.ndim)
#[Output]:
#2
print(a.shape)
#[Output]:
#(4, 3)
print(a.size)
#[Output]:
#12
print(a.dtype)
#[Output]:
#int32
print(a.data)
#[Output]:
#<memory at 0x074C8738>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment