0
>>> db
array([[[[   48.4473645 ,  -49.42020132,  -59.52442657,  199.95277333,
            131.69291221,  -69.15365214, -155.71041334,   16.42950385]]]])

>>> db_test
array([[[[   48.4473645 ,  -49.42020132,  -59.52442657,  199.95277333,
            131.69291221,  -69.15365214, -155.71041334,   16.42950385]]]])

>>> db == db_test
array([[[[False, False, False, False, False, False, False, False]]]])

It seems that these two arrays are identical, but they aren't. Can you explain me why?

vanPelt2
  • 870
  • 6
  • 16
  • 1
    Please provide how you get db and db_test – OlorinIstari May 25 '20 at 16:39
  • can you print type(db[0][0][0]) and type(db_test[0][0][0]) – Kaushik J May 25 '20 at 16:41
  • Hello Walentines44, thank you very much for your question! Please provide your code and data as text and not as image so it is reproducible for users. Please consider looking here for guidance: [https://stackoverflow.com/help/how-to-ask](https://stackoverflow.com/help/how-to-ask) Thank you! – mozart_kv467 May 25 '20 at 16:44
  • 2
    Try `np.isclose`. Floats often don't test exactly. – hpaulj May 25 '20 at 16:44
  • i get True using np.isclose – walentines44 May 25 '20 at 16:46
  • If using "np.isclose" solved your problem, please mark your question as "closed", so others know it is closed. – Itamar Mushkin May 26 '20 at 08:53
  • To read more about the issue of floating point comparison in Python, visit: https://stackoverflow.com/questions/5595425/what-is-the-best-way-to-compare-floats-for-almost-equality-in-python. Consider if your question is a duplicate of that one. – Itamar Mushkin May 26 '20 at 08:55

0 Answers0