ndarray的大小何时不固定? [英] When is the size of an ndarray not fixed?
本文介绍了ndarray的大小何时不固定?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
ndarray是一个(通常为固定大小)多维容器,其中包含相同类型和大小的项目.
An ndarray is a (usually fixed-size) multidimensional container of items of the same type and size.
我对这里的形容词通常感到惊讶.我认为ndarray始终是固定大小的.何时ndarray的大小不固定?
I'm surprised by the adjective usually here. I thought an ndarray is always of a fixed size. When is the size of an ndarray not fixed?
推荐答案
您可以重塑尺寸,因此内存本身是固定大小的,但是可以调整形状(因此可能无法固定)尺寸).
You are allowed to reshape the dimensions, so the memory itself is fixed-sized, but the way you shape it may be adapted (hence it may not be fixed dimensions).
您可以使用resize
调整数组的大小,但这基本上是一个新数组.
You can resize the array with resize
, but it's basically a new array.
这篇关于ndarray的大小何时不固定?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文