0

What is the difference between

train_x = np.asarray([[0.0], [1.0], [2.0], [3.0], [4.0]])
train_y = np.asarray([1.0, 1.1, 3.0, 2.0, 5.0])

in Python numpy.asarray assignment? What is the meaning of [] brakets in the first line?

Thank you.

BlueTree
  • 169
  • 11

1 Answers1

0

The difference is creating a numpy array from a list of floats (1D) vs creating an array from a list of list of floats (2D)

romeric
  • 2,045
  • 2
  • 17
  • 33