Details of failed tests for parse_data_from_input
Failed test case: incorrect dtype for images array when using csv with 100 data points.
Expected:
either np.float64 or np.float32,
but got:
<U3.
Failed test case: incorrect dtype for labels array when using csv with 100 data points.
Expected:
either np.float64 or np.float32,
but got:
<U2.
All tests passed for train_val_generators!
All tests passed for create_model!
and this is my code:
# GRADED FUNCTION: parse_data_from_input
def parse_data_from_input(filename):
with open(filename) as file:
### START CODE HERE
# Use csv.reader, passing in the appropriate delimiter
# Remember that csv.reader can be iterated and returns one line in each iteration
csv_reader = csv.reader(file, delimiter=",")
next(csv_reader)
data = list(csv_reader)
labels = []
images = []
for row in data:
labels.append(row[0])
images.append(row[1:])
images = np.array(images)
images.astype('float64')
images=np.reshape(images,(images.shape[0],28,28))
labels = np.array(labels)
labels.astype('float64')
### END CODE HERE
return images, labels
The expected output is correct, i don’t understand why it failed