Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

3 dimensional array numpy

# required libraries
import numpy as npy

array_3d = npy.array(
    [[[1, 1, 1, 1],
    [1, 1, 1, 1],
    [1, 1, 1, 1]],
    
    [[1, 1, 1, 1],
    [1, 1, 1, 1],
    [1, 1, 1, 1]]])

print(array_3d)
print("Number of dimensions: " ,array_3d.ndim, ", Shape: ", array_3d.shape)
# you can type the array yourself like this
# or you could do somethong like this

ones = npy.ones((2, 3, 4), dtype=int)
print(ones)
print("Number of dimensions: " ,ones.ndim, ", Shape: ", ones.shape)
# and get the same result
Comment

PREVIOUS NEXT
Code Example
Python :: 3d array python numpy 
Python :: append value to numpy array 
Python :: how to close a python program 
Python :: matplotlib figure cut off 
Python :: split datetime to date and time pandas 
Python :: number system conversion python 
Python :: python numpy array size of n 
Python :: for one line python 
Python :: python merge pdf files into one 
Python :: string to list python 
Python :: how to remove vowels from a string in python 
Python :: calculate mean on python 
Python :: xticks label matplotlib 
Python :: pandas check if column is sorted 
Python :: simple graph in matplotlib categorical variables 
Python :: python insert to sorted list 
Python :: try except finally python 
Python :: drop first two rows pandas 
Python :: text widget get tkinter 
Python :: re.compile example 
Python :: validity of password in python 
Python :: python move cursor to previous line 
Python :: django add middleware 
Python :: how to get the value out of a dictionary python3 
Python :: tkinter disable button styles 
Python :: how to downgrade python 3.9 to 3.8 
Python :: mkvirtualenv environment python 3 
Python :: strp datetime 
Python :: pycocotools python3.7 
Python :: pygame get keypress code 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =