Skip to content

Commit c3dd032

Browse files
Merge pull request #8721 from jorisvandenbossche/to_dict-invalid-orient
ERR: leftover from renaming outtype to orient in to_dict
2 parents af2bfb7 + 7e41bcb commit c3dd032

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

pandas/core/frame.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -708,8 +708,8 @@ def to_dict(self, orient='dict'):
708708
elif orient.lower().startswith('r'):
709709
return [dict((k, v) for k, v in zip(self.columns, row))
710710
for row in self.values]
711-
else: # pragma: no cover
712-
raise ValueError("outtype %s not understood" % outtype)
711+
else:
712+
raise ValueError("orient '%s' not understood" % orient)
713713

714714
def to_gbq(self, destination_table, project_id=None, chunksize=10000,
715715
verbose=True, reauth=False):

pandas/tests/test_frame.py

+4
Original file line numberDiff line numberDiff line change
@@ -4158,6 +4158,10 @@ def test_to_dict(self):
41584158

41594159
tm.assert_almost_equal(recons_data, expected_records)
41604160

4161+
def test_to_dict_invalid_orient(self):
4162+
df = DataFrame({'A':[0, 1]})
4163+
self.assertRaises(ValueError, df.to_dict, orient='invalid')
4164+
41614165
def test_to_records_dt64(self):
41624166
df = DataFrame([["one", "two", "three"],
41634167
["four", "five", "six"]],

0 commit comments

Comments
 (0)