Skip to content

Commit 94ee32b

Browse files
committed
change default back to False
1 parent c5ddcc7 commit 94ee32b

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

pandas/core/frame.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,7 +1207,7 @@ def from_records(cls, data, index=None, exclude=None, columns=None,
12071207

12081208
return cls(mgr)
12091209

1210-
def to_records(self, index=True, convert_datetime64=None):
1210+
def to_records(self, index=True, convert_datetime64=False):
12111211
"""
12121212
Convert DataFrame to record array. Index will be put in the
12131213
'index' field of the record array if requested
@@ -1216,7 +1216,7 @@ def to_records(self, index=True, convert_datetime64=None):
12161216
----------
12171217
index : boolean, default True
12181218
Include index in resulting record array, stored in 'index' field
1219-
convert_datetime64 : boolean, default True
1219+
convert_datetime64 : boolean, default False
12201220
.. deprecated:: 0.23.0
12211221
12221222
Whether to convert the index to datetime.datetime if it is a
@@ -1227,13 +1227,11 @@ def to_records(self, index=True, convert_datetime64=None):
12271227
y : recarray
12281228
"""
12291229

1230-
if convert_datetime64 is not None:
1230+
if convert_datetime64:
12311231
warnings.warn("The 'convert_datetime64' parameter is "
12321232
"deprecated and will be removed in a future "
12331233
"version",
12341234
FutureWarning, stacklevel=2)
1235-
else:
1236-
convert_datetime64 = True
12371235

12381236
if index:
12391237
if is_datetime64_any_dtype(self.index) and convert_datetime64:

pandas/tests/frame/test_convert_to.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,19 +79,16 @@ def test_to_records_dt64(self):
7979
["four", "five", "six"]],
8080
index=date_range("2012-01-01", "2012-01-02"))
8181

82-
with tm.assert_produces_warning(FutureWarning):
83-
expected = df.index[0]
84-
result = df.to_records(convert_datetime64=True)['index'][0]
85-
assert expected == result
86-
87-
expected = df.index[0]
88-
# convert_datetime64 defaults to True if not passed
82+
# convert_datetime64 defaults to False if not passed
83+
expected = df.index.values[0]
8984
result = df.to_records()['index'][0]
9085
assert expected == result
9186

87+
# check for FutureWarning if convert_datetime64=True is passed
9288
with tm.assert_produces_warning(FutureWarning):
93-
rs = df.to_records(convert_datetime64=False)
94-
assert rs['index'][0] == df.index.values[0]
89+
expected = df.index[0]
90+
result = df.to_records(convert_datetime64=True)['index'][0]
91+
assert expected == result
9592

9693
def test_to_records_with_multindex(self):
9794
# GH3189

0 commit comments

Comments
 (0)