File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change 4
4
from pandas .compat import lrange , zip
5
5
6
6
import numpy as np
7
- from pandas import Index , Series , DataFrame
7
+ from pandas import Index , Series , DataFrame , NaT
8
8
9
9
from pandas .tseries .index import date_range , bdate_range
10
10
from pandas .tseries .offsets import DateOffset
@@ -778,6 +778,23 @@ def test_mixed_freq_irreg_period(self):
778
778
irreg .plot ()
779
779
ps .plot ()
780
780
781
+ def test_nat_handling (self ):
782
+
783
+ import matplotlib .pyplot as plt
784
+
785
+ fig = plt .gcf ()
786
+ plt .clf ()
787
+ ax = plt .gca ()
788
+
789
+ dti = DatetimeIndex (['2015-01-01' , NaT , '2015-01-03' ])
790
+ s = Series (range (len (dti )), dti )
791
+ s .plot (ax = ax )
792
+ xdata = ax .get_lines ()[0 ].get_xdata ()
793
+ # plot x data is bounded by index values
794
+ self .assertLessEqual (s .index .min (), Series (xdata ).min ())
795
+ self .assertLessEqual (Series (xdata ).max (), s .index .max ())
796
+ _check_plot_works (s .plot )
797
+
781
798
@slow
782
799
def test_to_weekly_resampling (self ):
783
800
idxh = date_range ('1/1/1999' , periods = 52 , freq = 'W' )
You can’t perform that action at this time.
0 commit comments