filmov
tv
52. NumPy Arrays Reorganizing Functions with Code || asarray(), reshape(), flatten() ,hstack, vstack

Показать описание
asarray() function is used when we want to convert input to an array. Input can be lists, lists of tuples, tuples, tuples of tuples, tuples of lists and arrays.
reshape() function allows us to reshape an array in Python. Reshaping basically means, changing the shape of an array.
flatten() function is used to get a copy of an given array collapsed into one dimension.
hstack() function is used to stack arrays in sequence horizontally (column wise).
vstack() function is used to stack arrays in sequence vertically (row wise).
linspace() is used to create an evenly spaced sequence in a specified interval.
logspace() function return numbers spaced evenly on a log scale.
Code:
#asarray
import numpy as np
print(a)
print(a)
print(b)
#reshape data
print(e)
#hstack
#vstack
print(normal_array)
#Linspace
print(x)
#logspace
print(y)
reshape() function allows us to reshape an array in Python. Reshaping basically means, changing the shape of an array.
flatten() function is used to get a copy of an given array collapsed into one dimension.
hstack() function is used to stack arrays in sequence horizontally (column wise).
vstack() function is used to stack arrays in sequence vertically (row wise).
linspace() is used to create an evenly spaced sequence in a specified interval.
logspace() function return numbers spaced evenly on a log scale.
Code:
#asarray
import numpy as np
print(a)
print(a)
print(b)
#reshape data
print(e)
#hstack
#vstack
print(normal_array)
#Linspace
print(x)
#logspace
print(y)