File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 1212 cast ,
1313 overload ,
1414)
15- import warnings
1615
1716import numpy as np
1817
3029 timezones as libtimezones ,
3130)
3231from pandas ._libs .tslibs .conversion import cast_from_unit_vectorized
32+ from pandas ._libs .missing import NAType
3333from pandas ._libs .tslibs .dtypes import NpyDatetimeUnit
3434from pandas ._libs .tslibs .parsing import (
3535 DateParseError ,
4242 DateTimeErrorChoices ,
4343)
4444from pandas .util ._decorators import set_module
45- from pandas .util ._exceptions import find_stack_level
4645
4746from pandas .core .dtypes .common import (
4847 ensure_object ,
@@ -149,7 +148,11 @@ def _guess_datetime_format_for_array(
149148 # Look through the formats and see if one satisfies each item in the array
150149 for fmt in list (allowed_formats ):
151150 try :
152- [datetime .strptime (date_string , fmt ) for date_string in arr if date_string ]
151+ [
152+ datetime .strptime (date_string , fmt )
153+ for date_string in arr
154+ if date_string and not isinstance (date_string , NAType )
155+ ]
153156 return fmt
154157 except ValueError :
155158 pass
You can’t perform that action at this time.
0 commit comments