File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -2644,6 +2644,7 @@ def maybe_convert_objects(ndarray[object] objects,
2644
2644
2645
2645
elif seen.time_:
2646
2646
if is_time_array(objects):
2647
+ # FIXME: need to ensure this is not timetz
2647
2648
opt = get_option(" future.infer_time" )
2648
2649
if opt is True :
2649
2650
import pyarrow as pa
Original file line number Diff line number Diff line change @@ -832,6 +832,29 @@ def infer_dtype_from_scalar(val) -> tuple[DtypeObj, Any]:
832
832
pa_dtype = pa .time64 ("us" )
833
833
dtype = ArrowDtype (pa_dtype )
834
834
835
+ elif isinstance (val , dt .time ):
836
+ if val .tzinfo is None :
837
+ # pyarrow doesn't have a dtype for timetz.
838
+ opt = get_option ("future.infer_time" )
839
+ if opt is None :
840
+ warnings .warn (
841
+ "Pandas type inference with a `datetime.time` "
842
+ "object is deprecated. In a future version, this will give "
843
+ "time32[pyarrow] dtype, which will require pyarrow to be "
844
+ "installed. To opt in to the new behavior immediately set "
845
+ "`pd.set_option('future.infer_time', True)`. To keep the "
846
+ "old behavior pass `dtype=object`." ,
847
+ FutureWarning ,
848
+ stacklevel = find_stack_level (),
849
+ )
850
+ elif opt is True :
851
+ import pyarrow as pa
852
+
853
+ pa_dtype = pa .time64 ("us" )
854
+ from pandas .core .arrays .arrow import ArrowDtype
855
+
856
+ dtype = ArrowDtype (pa_dtype )
857
+
835
858
elif is_bool (val ):
836
859
dtype = np .dtype (np .bool_ )
837
860
You can’t perform that action at this time.
0 commit comments