numpy数组:序列太大 [英] Numpy array: sequence too large

查看:220
本文介绍了numpy数组:序列太大的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个大小为11的数组,称为波长",还有一个更大的大小为n的数组,称为"MN".而'model'是m by n数组.

I have an array of size 11 called 'wavelength' and a larger array of size n called 'MN'. And 'model' is an m by n array.

我正在这样做:

for i in xrange(10+len(wavelength)-2):
  y=np.empty(model[MN][i],float)

并将其作为错误:

  File "test_prog.py", line 658, in <module>
    y=np.empty(model[MN][i],float)
ValueError: sequence too large; must be smaller than 32

我不确定该怎么办.我在网上其他地方看过,但找不到任何明显的实质内容.

I'm not sure what to do about that. I've looked elsewhere online but I can't find anything of obvious substance.

推荐答案

sequence too large错误表示您正在创建尺寸大于32的多维数组.例如:np.empty([1]*33)将引发此错误.

sequence too large error means that you are creating a multidimension array that has a dimension larger than 32. For example: np.empty([1]*33) will raise this error.

确定要创建> 32维数组吗?如果要创建与model[MN][i]形状相同的空数组,则应使用:empty_like()

Are you sure you want to create >32 dimension array? If you want to create an empty array the same shape as model[MN][i], you should use: empty_like()

这篇关于numpy数组:序列太大的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆