@@ -649,6 +649,26 @@ def test_to_timestamp_business_end(self):
649
649
expected = pd .Timestamp ("1990-01-06" ) - pd .Timedelta (nanoseconds = 1 )
650
650
assert result == expected
651
651
652
+ @pytest .mark .parametrize (
653
+ "ts, expected" ,
654
+ [
655
+ ("1970-01-01 00:00:00" , 0 ),
656
+ ("1970-01-01 00:00:00.000001" , 1 ),
657
+ ("1970-01-01 00:00:00.00001" , 10 ),
658
+ ("1970-01-01 00:00:00.499" , 499000 ),
659
+ ("1999-12-31 23:59:59.999" , 999000 ),
660
+ ("1999-12-31 23:59:59.999999" , 999999 ),
661
+ ("2050-12-31 23:59:59.5" , 500000 ),
662
+ ("2050-12-31 23:59:59.500001" , 500001 ),
663
+ ("2050-12-31 23:59:59.123456" , 123456 ),
664
+ ],
665
+ )
666
+ @pytest .mark .parametrize ("freq" , [None , "us" , "ns" ])
667
+ def test_to_timestamp_microsecond (self , ts , expected , freq ):
668
+ # GH 24444
669
+ result = Period (ts ).to_timestamp (freq = freq ).microsecond
670
+ assert result == expected
671
+
652
672
# --------------------------------------------------------------
653
673
# Rendering: __repr__, strftime, etc
654
674
0 commit comments