File tree 1 file changed +17
-0
lines changed
1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -501,6 +501,23 @@ def test_obj_none_preservation(self):
501
501
502
502
tm .assert_numpy_array_equal (result , expected , strict_nan = True )
503
503
504
+ def test_signed_zero (self ):
505
+ a = np .array ([- 0.0 , 0.0 ])
506
+ result = pd .unique (a )
507
+ expected = np .array ([- 0.0 ]) # 0.0 and -0.0 are equivalent
508
+ tm .assert_numpy_array_equal (result , expected )
509
+
510
+ def test_different_nans (self ):
511
+ # create different nans from bit-patterns:
512
+ NAN1 = struct .unpack ("d" , struct .pack ("=Q" , 0x7ff8000000000000 ))[0 ]
513
+ NAN2 = struct .unpack ("d" , struct .pack ("=Q" , 0x7ff8000000000001 ))[0 ]
514
+ assert NAN1 != NAN1
515
+ assert NAN2 != NAN2
516
+ a = np .array ([NAN1 , NAN2 ]) # NAN1 and NAN2 are equivalent
517
+ result = pd .unique (a )
518
+ expected = np .array ([np .nan ])
519
+ tm .assert_numpy_array_equal (result , expected )
520
+
504
521
505
522
class TestIsin (object ):
506
523
You can’t perform that action at this time.
0 commit comments