Skip to content

Commit f78275f

Browse files
committed
float precision fix
1 parent 431e10a commit f78275f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pandas/io/tests/parser/dtypes.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@
1717
class DtypeTests(object):
1818
def test_passing_dtype(self):
1919
# see gh-6607
20-
df = DataFrame(np.random.rand(5, 2), columns=list(
20+
df = DataFrame(np.random.rand(5, 2).round(4), columns=list(
2121
'AB'), index=['1A', '1B', '1C', '1D', '1E'])
2222

2323
with tm.ensure_clean('__passing_str_as_dtype__.csv') as path:
24-
df.to_csv(path, float_format='%.12f')
24+
df.to_csv(path)
2525

2626
# see gh-3795: passing 'str' as the dtype
2727
result = self.read_csv(path, dtype=str, index_col=0)
28-
expected = df.applymap(lambda x: '%.12f' % (x,))
28+
expected = df.astype(str)
2929
tm.assert_frame_equal(result, expected)
3030

3131
# for parsing, interpret object as str

0 commit comments

Comments
 (0)