【问题标题】:How do I collect the csv datasets as a matrix instead of a tuple?如何将 csv 数据集收集为矩阵而不是元组?
【发布时间】:2023-03-09 10:17:02
【问题描述】:
#helper libraries
import numpy as np
import pandas as pd

#loading the data
import os
train_dataset = pd.read_csv("/content/sample_data/mnist_train_small.csv")
test_dataset = pd.read_csv("/content/sample_data/mnist_test.csv")

# each image is mapped to a label so  (a number from 1 to 10) so for ease of use the labels have been given class names
class_names = ['T-shirt/top', 'Pair of Trouser', 'Pull over', 'Dress', 'Coat', 'Sandal', 'Shirt', 'Sneaker', 'Bag', 'Ankle Boot']

#exploring the data
train_dataset.shape()
test_dataset.shape()

TypeError Traceback(最近一次调用最后一次) 在 () 1 #探索hte数据 2 """我们需要知道数据的维度,以便我们知道如何最好地连接或给它任何类似的过程""" ----> 3 train_dataset.shape() 4 test_dataset.shape()

TypeError: 'tuple' 对象不可调用

【问题讨论】:

    标签: python pandas database csv deep-learning


    【解决方案1】:

    Shape 不是可调用函数。只需使用如下而不是shape(),您将获得它的尺寸

    train_dataset.shape
    test_dataset.shape
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-02-01
      • 2012-08-08
      • 2017-06-07
      • 1970-01-01
      • 2017-04-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多