SoFunction
Updated on 2024-11-12

Explaining Numpy's properties and creating matrices in python in detail

:: Dimension

: Shape

: Number of elements

: Element data type

: Byte size

Creating arrays:

a = ([2,23,4]) 
# list 1d
print(a)
# [2 23 4]

Specifies the data type:

a = ([2,23,4],dtype=)
print()
# int 64

dtype can specify the type of int32, float, float32, not followed by the number of default 64

a = ((3,4)) # Data all zeros, 3 rows, 4 columns
"""

 

a = ((3,4),dtype = )  # Data is 1, 3 rows and 4 columns
a = ((3,4)) # data forempty,3classifier for objects in rows such as words4columns

empty type: initial content is randomized, depending on the state of the memory

a = (10,20,2) # 10-19 of data, 2 steps
a = (12).reshape((3,4))  # 3classifier for objects in rows such as words4columns,0until (a time)11

reshape modifies the shape of the data, e.g. 3 rows and 4 columns.

a = (1,10,20)  # starting point1,closing end10,and split into20data,Generate line segments

linspace can determine the amount of data, whereas arrage cannot, and also linspace can define structures using reshape.