0

I have a numpy array with shape (1,x,1) and the second one also with shape (1,x,1). I wonder how can I check whether they are the same? Examples:

1. First:

[[[ 2]
  [ 3]
  [ 4]
  [ 5]
  [ 6]
  [ 7]
  [ 8]
  [ 9]
  [ 4]
  [ 6]
  [10]]]

Second:

[[[ 2]
  [ 3]
  [ 4]
  [ 5]
  [ 6]
  [ 7]
  [ 8]
  [ 9]
  [ 4]
  [ 6]
  [10]]]

Response: True

2.

First:

[[[ 2]
  [ 3]
  [ 4]
  [ 5]
  [ 6]
  [ 7]
  [ 8]
  [ 9]
  [ 4]]]

Second:

[[[ 1]
  [ 2]
  [ 3]
  [ 5]
  [ 6]
  [ 2]
  [ 8]
  [ 3]
  [ 5]]]

Response: False

thedbogh
  • 614
  • 2
  • 10
  • 26

1 Answers1

0

There is already a SO question with that topic and a good answer by @Juh_ link.

The solution:

(A==B).all()
Sebastian Dengler
  • 1,258
  • 13
  • 30