pythonbook/实例学习Numpy与Matplotlib/Numpy属性.py

12 lines
284 B
Python

import numpy as np
# reshape
b1 = np.arange(15)
b2 = b1.reshape((3,5))
print(f"b1 = {b1} \n "
f"b2 = {b2} \n "
f"b1.ndim = {b1.ndim} b2.ndim= {b2.ndim} \n "
f"b1.shape = {b1.shape} b2.shape = {b2.shape} \n "
f"b1.size = {b1.size} b2.size = {b2.size} \n "
)