本文整理汇总了Python中dazzle.core.table.Table.head方法的典型用法代码示例。如果您正苦于以下问题:Python Table.head方法的具体用法?Python Table.head怎么用?Python Table.head使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dazzle.core.table.Table
的用法示例。
在下文中一共展示了Table.head方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestTable
# 需要导入模块: from dazzle.core.table import Table [as 别名]
# 或者: from dazzle.core.table.Table import head [as 别名]
#.........这里部分代码省略.........
self.assertEqual(self.u[0]['b'], 20.2)
self.assertEqual(self.u[1]['a'], 190)
# def test_set_item03(self):
# self.u[[0, 1]]['a'] = 40 # makes a copy; u is not modified
# self.assertEqual(self.u[0]['a'], 40)
# def test_set_item04(self):
# self.u[0]['a'] = 14 # makes a copy; u is not modified
# self.assertEqual(self.u[0]['a'], 14)
def test_str01(self):
s = \
"u(a: int32, b: float64)" \
"2 row(s) - compressed: 2.00 MB - comp. ratio: 0.00" \
"+---+-------+" \
"| a | b |" \
"+---+-------+" \
"| 1 | 1.100 |" \
"| 2 | 2.200 |" \
"+---+-------+"
self.assert_string_equal(self.u.__str__(), s)
def test_str02(self):
s = \
"u(a: int32, b: float64)" \
"2 row(s) - compressed: 2.00 MB - comp. ratio: 0.00" \
"+---+-------+" \
"| a | b |" \
"+---+-------+" \
"| 1 | 1.100 |" \
"| 2 | 2.200 |" \
"+---+-------+"
self.assert_string_equal(self.u.__str__(head=20), s)
def test_str03(self):
s = \
"u(a: int32, b: float64)" \
"2 row(s) - compressed: 2.00 MB - comp. ratio: 0.00" \
"+---+-----+" \
"| a | b |" \
"+---+-----+" \
"| 1 | 1.1 |" \
"| 2 | 2.2 |" \
"+---+-----+"
self.u.get_column("b").format = "%.1f"
self.assert_string_equal(self.u.__str__(head=20), s)
def test_head01(self):
s = \
"u(a: int32, b: float64)" \
"2 row(s) - compressed: 2.00 MB - comp. ratio: 0.00" \
"+-----+-------+" \
"| a | b |" \
"+-----+-------+" \
"| 1 | 1.100 |" \
"| ... | ... |" \
"+-----+-------+"
self.assert_string_equal(self.u.head(1), s)
def test_tail01(self):
s = \
"u(a: int32, b: float64)" \
"2 row(s) - compressed: 2.00 MB - comp. ratio: 0.00" \
"+-----+-------+" \
"| a | b |" \