简体   繁体   English

MemoryError:无法为形状为 (323313, 3435) 且数据类型为 float64 的数组分配 8.27 GiB

[英]MemoryError: Unable to allocate 8.27 GiB for an array with shape (323313, 3435) and data type float64

I have extension(example .exe,.py,.xml,.doc etc) table in my dataframe.我的数据框中有扩展名(例如 .exe、.py、.xml、.doc 等)表。 after running on terminal I am getting above error on large data set.在终端上运行后,我在大数据集上遇到了上述错误。

encoder = OneHotEncoder(handle_unknown='ignore')
encoder.fit(features['Extension'].values.reshape(-1, 1))
temp = encoder.transform(features['Extension'].values.reshape(-1, 1)).toarray()  #GETTING ERROR on this
print("Size of array in bytes",getsizeof(temp))
print("Array :-",temp)
print("Shape :- ",features.shape, temp.shape)
features.drop(columns=['Extension'], axis=1, inplace=True)
dump(encoder, os.path.join(os.getcwd(), 'model_dumps', 'encoder.pkl'))
features.drop(columns=['Extension'], axis=1, inplace=True)
features = featureScaling(features)
features = np.concatenate((features, temp), axis=1)

OUTPUT -输出 -

1) Size of array in bytes :- 8884558912
2) Array :- 
[[0. 0. 0. ... 0. 0. 0.]
 [0. 0. 0. ... 0. 0. 0.]
 [0. 0. 0. ... 0. 0. 0.]
 ...
 [1. 0. 0. ... 0. 0. 0.]
 [1. 0. 0. ... 0. 0. 0.]
 [1. 0. 0. ... 0. 0. 0.]]
3)Shape :- (323310, 8) (323310, 3435)

that's funny.那很好笑。

MemoryError: Unable to allocate 8.27 GiB for an array with shape (323313, 3435) and data type float64 MemoryError:无法为形状为 (323313, 3435) 且数据类型为 float64 的数组分配 8.27 GiB

most modern computers don't have more than 8 Gb of RAM.大多数现代计算机的 RAM 不超过 8 Gb。 Looks like you have 8 and python is not able to fit all this data in the memory.看起来您有 8 个,而 python 无法将所有这些数据放入内存中。 Try buying another computer with more ram or upgrade your existing one.尝试购买另一台具有更多内存的计算机或升级您现有的计算机。 This will definitely fix the issue.这肯定会解决问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 MemoryError:无法为形状为 (28709, 224, 224, 3) 且数据类型为 float64 的数组分配 32.2 GiB - MemoryError: Unable to allocate 32.2 GiB for an array with shape (28709, 224, 224, 3) and data type float64 MemoryError: Unable to allocate 115. GiB for an array with shape (1122, 1122, 12288) and data type float64 - MemoryError: Unable to allocate 115. GiB for an array with shape (1122, 1122, 12288) and data type float64 MemoryError: Unable to allocate 617. GiB for an array with shape (82754714206,) and data type float64 On Windows and using Python - MemoryError: Unable to allocate 617. GiB for an array with shape (82754714206,) and data type float64 On Windows and using Python MemoryError: 无法分配形状为 (200, 20, 244, 244, 3) 和数据类型为 float64 的数组 - MemoryError: Unable to allocate array with shape (200, 20, 244, 244, 3) and data type float64 MemoryError: 无法分配形状 (118, 840983) 和数据类型 float64 的数组 - MemoryError: Unable to allocate array with shape (118, 840983) and data type float64 MemoryError: Unable to allocate 797. MiB for an array with shape (51, 51, 40169) and data type float64 - MemoryError: Unable to allocate 797. MiB for an array with shape (51, 51, 40169) and data type float64 找到暗淡为 3 的数组。StandardScaler 预期 &lt;= 2,无法为形状为 (34997、244、244) 且数据类型为 float64 的数组分配 15.5 GiB - Found array with dim 3. StandardScaler expected <= 2,Unable to allocate 15.5 GiB for an array with shape (34997, 244, 244) and data type float64 MemoryError:无法为形状为 (5844379795,) 且数据类型为 int64 的数组分配 43.5 GiB - MemoryError: Unable to allocate 43.5 GiB for an array with shape (5844379795,) and data type int64 MemoryError: 无法为 DIPY 图像配准中具有形状 (344, 344, 127) 和数据类型 float64 的数组分配 115. MiB - MemoryError: Unable to allocate 115. MiB for an array with shape (344, 344, 127) and data type float64 in DIPY image registration MemoryError: Unable to allocate 5.62 GiB for an array with shape (16384, 30720, 3) and data type float32 when training StyleGan2 - MemoryError: Unable to allocate 5.62 GiB for an array with shape (16384, 30720, 3) and data type float32 When training StyleGan2
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM