def test_repr_chop_threshold(self):
df = DataFrame([[0.1, 0.5], [0.5, -0.1]])
pd.reset_option("display.chop_threshold") # default None
self.assertEqual(repr(df), ' 0 1\n0 0.1 0.5\n1 0.5 -0.1')
with option_context("display.chop_threshold", 0.2):
self.assertEqual(repr(df), ' 0 1\n0 0.0 0.5\n1 0.5 0.0')
with option_context("display.chop_threshold", 0.6):
self.assertEqual(repr(df), ' 0 1\n0 0.0 0.0\n1 0.0 0.0')
with option_context("display.chop_threshold", None):
self.assertEqual(repr(df), ' 0 1\n0 0.1 0.5\n1 0.5 -0.1')
test_format.py 文件源码
python
阅读 25
收藏 0
点赞 0
评论 0
评论列表
文章目录