def test_too_long(self):
# GH 10451
with pd.option_context('display.precision', 4):
# need both a number > 1e6 and something that normally formats to
# having length > display.precision + 6
df = pd.DataFrame(dict(x=[12345.6789]))
self.assertEqual(str(df), ' x\n0 12345.6789')
df = pd.DataFrame(dict(x=[2e6]))
self.assertEqual(str(df), ' x\n0 2000000.0')
df = pd.DataFrame(dict(x=[12345.6789, 2e6]))
self.assertEqual(
str(df), ' x\n0 1.2346e+04\n1 2.0000e+06')
test_format.py 文件源码
python
阅读 42
收藏 0
点赞 0
评论 0
评论列表
文章目录