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 @@ -833,6 +833,29 @@ def infer_dtype_from_scalar(val) -> tuple[DtypeObj, Any]:
833
833
834
834
dtype = ArrowDtype (pa_dtype )
835
835
836
+ elif isinstance (val , dt .time ):
837
+ if val .tzinfo is None :
838
+ # pyarrow doesn't have a dtype for timetz.
839
+ opt = get_option ("future.infer_time" )
840
+ if opt is None :
841
+ warnings .warn (
842
+ "Pandas type inference with a `datetime.time` "
843
+ "object is deprecated. In a future version, this will give "
844
+ "time32[pyarrow] dtype, which will require pyarrow to be "
845
+ "installed. To opt in to the new behavior immediately set "
846
+ "`pd.set_option('future.infer_time', True)`. To keep the "
847
+ "old behavior pass `dtype=object`." ,
848
+ FutureWarning ,
849
+ stacklevel = find_stack_level (),
850
+ )
851
+ elif opt is True :
852
+ import pyarrow as pa
853
+
854
+ pa_dtype = pa .time64 ("us" )
855
+ from pandas .core .arrays .arrow import ArrowDtype
856
+
857
+ dtype = ArrowDtype (pa_dtype )
858
+
836
859
elif is_bool (val ):
837
860
dtype = np .dtype (np .bool_ )
838
861
You can’t perform that action at this time.
0 commit comments