本文整理匯總了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 |" \