We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 88a471a commit abdae04Copy full SHA for abdae04
pandas/io/sql.py
@@ -705,8 +705,16 @@ def insert_data(self):
705
else:
706
# convert to microsecond resolution for datetime.datetime
707
d = b.values.astype("M8[us]").astype(object)
708
+ elif b.is_timedelta:
709
+ # numpy converts this to an object array of integers,
710
+ # whereas b.astype(object).values would convert to
711
+ # object array of Timedeltas
712
+ d = b.values.astype(object)
713
- d = np.array(b.get_values(), dtype=object)
714
+ # TODO(2DEA): astype-first can be avoided with 2D EAs
715
+ # astype on the block instead of values to ensure we
716
+ # get the right shape
717
+ d = b.astype(object).values
718
719
# replace NaN with None
720
if b._can_hold_na:
0 commit comments