Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python 3d array

Explaination:
	import numpy as np

	np.zeros(the amount of arrays, amount of rows, the amount of colums)
---------------------------------------------------------------------
Usage:
	array_city = np.zeros((2, 3, 4))
	print(array_city)
---------------------------------------------------------------------
Results:
[
    [
      [0. 0. 0. 0.],
  	  [0. 0. 0. 0.],
      [0. 0. 0. 0.],
    ],
      
    [
      [0. 0. 0. 0.],
      [0. 0. 0. 0.],
      [0. 0. 0. 0.],
    ]
]
Comment

python 3D array

import pprint    # importing pretty printed
  
def ThreeD(a, b, c):
    lst = [[ ['#' for values in range(a)] for col in range(b)] for row in range(c)]
    return lst
      
values= 5
col = 3
row = 2
# used the pretty printed function
pprint.pprint(ThreeD(values, col, row))

""" OUTPUT
[[['#', '#', '#', '#', '#'],
  ['#', '#', '#', '#', '#'],
  ['#', '#', '#', '#', '#']],
 [['#', '#', '#', '#', '#'],
  ['#', '#', '#', '#', '#'],
  ['#', '#', '#', '#', '#']]]
  """
Comment

PREVIOUS NEXT
Code Example
Python :: extends template django 
Python :: get_dummies 
Python :: python make file executable 
Python :: how to check if an element is in a list python 
Python :: check if year is leap python 
Python :: django include 
Python :: Django custome login 
Python :: voice translate python 
Python :: python split string size 
Python :: pyqt5 image center 
Python :: python look up how many rows in dataframe 
Python :: replace nan with 0 pandas 
Python :: Python, importing other scripts from other directories 
Python :: python string remove accent 
Python :: filter django or 
Python :: set allowed methods flask 
Python :: disable close button in tkinter 
Python :: how to take input for list in one line in python 
Python :: mediana python 
Python :: primary key auto increment python django 
Python :: dataframe to dictionary using index as key 
Python :: drop rows where specific column has null values 
Python :: open excel through python 
Python :: get query params flask 
Python :: downsample image opencv 
Python :: seaborn Using the dark theme python 
Python :: how to make dictionary in python 
Python :: remove item list python 
Python :: right-left staircase python 
Python :: model evaluate function 
ADD CONTENT
Topic
Content
Source link
Name
8+1 =