66
66
ensure_platform_int ,
67
67
infer_dtype_from_object ,
68
68
is_bool_dtype ,
69
- is_datetime64_any_dtype ,
70
69
is_dict_like ,
71
70
is_dtype_equal ,
72
71
is_extension_array_dtype ,
@@ -1685,9 +1684,7 @@ def from_records(
1685
1684
1686
1685
return cls (mgr )
1687
1686
1688
- def to_records (
1689
- self , index = True , convert_datetime64 = None , column_dtypes = None , index_dtypes = None
1690
- ):
1687
+ def to_records (self , index = True , column_dtypes = None , index_dtypes = None ):
1691
1688
"""
1692
1689
Convert DataFrame to a NumPy record array.
1693
1690
@@ -1699,11 +1696,6 @@ def to_records(
1699
1696
index : bool, default True
1700
1697
Include index in resulting record array, stored in 'index'
1701
1698
field or using the index label, if set.
1702
- convert_datetime64 : bool, default None
1703
- .. deprecated:: 0.23.0
1704
-
1705
- Whether to convert the index to datetime.datetime if it is a
1706
- DatetimeIndex.
1707
1699
column_dtypes : str, type, dict, default None
1708
1700
.. versionadded:: 0.24.0
1709
1701
@@ -1778,24 +1770,12 @@ def to_records(
1778
1770
dtype=[('I', 'S1'), ('A', '<i8'), ('B', '<f8')])
1779
1771
"""
1780
1772
1781
- if convert_datetime64 is not None :
1782
- warnings .warn (
1783
- "The 'convert_datetime64' parameter is "
1784
- "deprecated and will be removed in a future "
1785
- "version" ,
1786
- FutureWarning ,
1787
- stacklevel = 2 ,
1788
- )
1789
-
1790
1773
if index :
1791
- if is_datetime64_any_dtype (self .index ) and convert_datetime64 :
1792
- ix_vals = [self .index .to_pydatetime ()]
1774
+ if isinstance (self .index , ABCMultiIndex ):
1775
+ # array of tuples to numpy cols. copy copy copy
1776
+ ix_vals = list (map (np .array , zip (* self .index .values )))
1793
1777
else :
1794
- if isinstance (self .index , ABCMultiIndex ):
1795
- # array of tuples to numpy cols. copy copy copy
1796
- ix_vals = list (map (np .array , zip (* self .index .values )))
1797
- else :
1798
- ix_vals = [self .index .values ]
1778
+ ix_vals = [self .index .values ]
1799
1779
1800
1780
arrays = ix_vals + [self [c ]._internal_get_values () for c in self .columns ]
1801
1781
0 commit comments