Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

2d arrays using python numpy

import numpy as np

#create array of arrays
all_arrays = np.array([[10, 20, 30, 40, 50],
                       [60, 70, 80, 90, 100],
                       [110, 120, 130, 140, 150]])

#view array of arrays
print(all_arrays)

[[ 10  20  30  40  50]
 [ 60  70  80  90 100]
 [110 120 130 140 150]]
Comment

numpy make 2d array 1d

import numpy as np
  
ini_array1 = np.array([[1, 2, 3], [2, 4, 5], [1, 2, 3]])
  
# printing initial arrays
print("initial array", str(ini_array1))
  
# Multiplying arrays
result = ini_array1.flatten()
  
# printing result
print("New resulting array: ", result)
Comment

PREVIOUS NEXT
Code Example
Python :: python with 
Python :: python get audio from video 
Python :: lambda function if else in python 
Python :: django show image in admin page 
Python :: Converting (YYYY-MM-DD-HH:MM:SS) date time 
Python :: how to round to 3 significant figures in python 
Python :: python tableau 
Python :: merge two lists python 
Python :: how to add a list in python 
Python :: adding strings together 
Python :: dictionary append value python 
Python :: Python get first element from list 
Python :: len python meaning 
Python :: how to round to the nearest tenth in python 
Python :: python dictionary with list 
Python :: lemmatization in nlp 
Python :: how to tell python to go back to a previous line 
Python :: how to get text of a tag in selenium python 
Python :: python break 
Python :: print on same line 
Python :: python console install package 
Python :: python list merger 
Python :: check if digit or alphabet 
Python :: download maptolib 
Python :: plotly scatter facet change labels 
Python :: pandas excelfile 
Python :: python select file in folder given extension 
Python :: feature importance plot using lasso regression 
Python :: python vs java 
Python :: pd df replace 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =