Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit eb0b207

Browse files
committedApr 1, 2018
change default back to False
1 parent d195ece commit eb0b207

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed
 

‎pandas/core/frame.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -1288,7 +1288,7 @@ def from_records(cls, data, index=None, exclude=None, columns=None,
12881288

12891289
return cls(mgr)
12901290

1291-
def to_records(self, index=True, convert_datetime64=None):
1291+
def to_records(self, index=True, convert_datetime64=False):
12921292
"""
12931293
Convert DataFrame to a NumPy record array.
12941294
@@ -1356,13 +1356,11 @@ def to_records(self, index=True, convert_datetime64=None):
13561356
dtype=[('index', '<M8[ns]'), ('A', '<i8'), ('B', '<f8')])
13571357
"""
13581358

1359-
if convert_datetime64 is not None:
1359+
if convert_datetime64:
13601360
warnings.warn("The 'convert_datetime64' parameter is "
13611361
"deprecated and will be removed in a future "
13621362
"version",
13631363
FutureWarning, stacklevel=2)
1364-
else:
1365-
convert_datetime64 = True
13661364

13671365
if index:
13681366
if is_datetime64_any_dtype(self.index) and convert_datetime64:

‎pandas/tests/frame/test_convert_to.py

+6-9
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)