【问题标题】:how to reshape the csv file with 2118 row and 22 colums into 4 4 dimension如何将具有 2118 行和 22 列的 csv 文件重塑为 4 4 维
【发布时间】:2019-04-19 09:17:27
【问题描述】:

我想将 CSV 行和列重塑为 Python 中 CNN 可接受的 4 维形式。

行数为 2118,列数为 22

【问题讨论】:

标签: python-2.7 file csv


【解决方案1】:

您首先需要弄清楚每个维度的大小。之后您可以使用numpy.reshape

例如,我们可以将2118x22 数组转换为满足4 dimensions 要求的2118x22x1x1 数组,例如:

original_array = np.random.randint(0, 100, (2118, 22))
dim1, dim2, dim3, dim4 = 2118, 22, 1, 1
original_array.reshape((dim1, dim2 , dim3, dim4))

现在你的任务是找出dim1dim2dim3dim4 的数字。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-08-05
    • 1970-01-01
    • 2023-02-09
    • 2017-01-03
    • 1970-01-01
    • 1970-01-01
    • 2022-10-23
    • 2019-10-08
    相关资源
    最近更新 更多