[英]Unable to allocate 3.37 GiB for an array with shape (129213603, 28) and data type int8
if I run my python Code on Spyder, i get the above error code.如果我在 Spyder 上运行我的 python 代码,我会得到上述错误代码。 I have some pretty big lists, which I give into a
multiindex
我有一些非常大的列表,我将它们放入一个
multiindex
中
4 list: 4 名单:
customer_list = []
for y in df_1['Sold-to SAP Cust No']:
if y not in customer_list:
customer_list.append(y)
customer_list.sort()
df_c = pd.MultiIndex.from_product([
customer_list,
Material_list,
Week_list,
base_list],
The lists have about 200-300 entries.该列表有大约 200-300 个条目。
Does the error code mean that the lists are too big?错误代码是否意味着列表太大?
The issue is your attempting to allocate more memory than is available.问题是您尝试分配的 memory 比可用的多。
On Linux you can overcommit memory to a certain extent and on windows you can manage virtual memory.在 Linux 上,您可以在一定程度上过度使用 memory,在 windows 上,您可以管理虚拟 memory
Here is a link to a previous question on Stack Overflow that might be of some use.这是 Stack Overflow 上一个可能有用的问题的链接。 Unable to allocate array with shape and data type .
无法分配具有形状和数据类型的数组。
There are also some really interesting articles out there about managing memory.还有一些关于管理 memory 的非常有趣的文章。 My honest suggestion would be to research ways to manipulate your data without putting it all in memory.
我诚实的建议是研究处理数据的方法,而不是将其全部放入 memory。 You can store you data in a file or work with your data in a database.
您可以将数据存储在文件中或使用数据库中的数据。 Here is an article which talks about large datasets, How to handle large datasets .
这是一篇讨论大型数据集的文章, 如何处理大型数据集。 The article is directed towards pandas, but the concepts are the same.
文章针对的是pandas,但是概念是一样的。
You will benefit in the long run, especially if you attempt to run this program on different systems or work with larger datasets.从长远来看,您将受益,特别是如果您尝试在不同的系统上运行此程序或使用更大的数据集。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.