Skip to content

Commit fd0f114

Browse files
committed
change default back to False
1 parent ac0421d commit fd0f114

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

pandas/core/frame.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1297,7 +1297,7 @@ def from_records(cls, data, index=None, exclude=None, columns=None,
12971297

12981298
return cls(mgr)
12991299

1300-
def to_records(self, index=True, convert_datetime64=None):
1300+
def to_records(self, index=True, convert_datetime64=False):
13011301
"""
13021302
Convert DataFrame to a NumPy record array.
13031303
@@ -1365,13 +1365,11 @@ def to_records(self, index=True, convert_datetime64=None):
13651365
dtype=[('index', '<M8[ns]'), ('A', '<i8'), ('B', '<f8')])
13661366
"""
13671367

1368-
if convert_datetime64 is not None:
1368+
if convert_datetime64:
13691369
warnings.warn("The 'convert_datetime64' parameter is "
13701370
"deprecated and will be removed in a future "
13711371
"version",
13721372
FutureWarning, stacklevel=2)
1373-
else:
1374-
convert_datetime64 = True
13751373

13761374
if index:
13771375
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
@@ -80,19 +80,16 @@ def test_to_records_dt64(self):
8080
["four", "five", "six"]],
8181
index=date_range("2012-01-01", "2012-01-02"))
8282

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

88+
# check for FutureWarning if convert_datetime64=True is passed
9389
with tm.assert_produces_warning(FutureWarning):
94-
rs = df.to_records(convert_datetime64=False)
95-
assert rs['index'][0] == df.index.values[0]
90+
expected = df.index[0]
91+
result = df.to_records(convert_datetime64=True)['index'][0]
92+
assert expected == result
9693

9794
def test_to_records_with_multindex(self):
9895
# GH3189

0 commit comments

Comments
 (0)