本文整理匯總了Python中pandas.formats.style.Styler.render方法的典型用法代碼示例。如果您正苦於以下問題:Python Styler.render方法的具體用法?Python Styler.render怎麽用?Python Styler.render使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pandas.formats.style.Styler
的用法示例。
在下文中一共展示了Styler.render方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_table_attributes
# 需要導入模塊: from pandas.formats.style import Styler [as 別名]
# 或者: from pandas.formats.style.Styler import render [as 別名]
def test_table_attributes(self):
attributes = 'class="foo" data-bar'
styler = Styler(self.df, table_attributes=attributes)
result = styler.render()
self.assertTrue('class="foo" data-bar' in result)
result = self.df.style.set_table_attributes(attributes).render()
self.assertTrue('class="foo" data-bar' in result)
示例2: test_caption
# 需要導入模塊: from pandas.formats.style import Styler [as 別名]
# 或者: from pandas.formats.style.Styler import render [as 別名]
def test_caption(self):
styler = Styler(self.df, caption='foo')
result = styler.render()
self.assertTrue(all(['caption' in result, 'foo' in result]))
styler = self.df.style
result = styler.set_caption('baz')
self.assertTrue(styler is result)
self.assertEqual(styler.caption, 'baz')
示例3: test_uuid
# 需要導入模塊: from pandas.formats.style import Styler [as 別名]
# 或者: from pandas.formats.style.Styler import render [as 別名]
def test_uuid(self):
styler = Styler(self.df, uuid='abc123')
result = styler.render()
self.assertTrue('abc123' in result)
styler = self.df.style
result = styler.set_uuid('aaa')
self.assertTrue(result is styler)
self.assertEqual(result.uuid, 'aaa')
示例4: test_table_styles
# 需要導入模塊: from pandas.formats.style import Styler [as 別名]
# 或者: from pandas.formats.style.Styler import render [as 別名]
def test_table_styles(self):
style = [{'selector': 'th', 'props': [('foo', 'bar')]}]
styler = Styler(self.df, table_styles=style)
result = ' '.join(styler.render().split())
self.assertTrue('th { foo: bar; }' in result)
styler = self.df.style
result = styler.set_table_styles(style)
self.assertTrue(styler is result)
self.assertEqual(styler.table_styles, style)
示例5: test_render_double
# 需要導入模塊: from pandas.formats.style import Styler [as 別名]
# 或者: from pandas.formats.style.Styler import render [as 別名]
def test_render_double(self):
df = pd.DataFrame({"A": [0, 1]})
style = lambda x: pd.Series(["color: red; border: 1px",
"color: blue; border: 2px"], name=x.name)
s = Styler(df, uuid='AB').apply(style)
s.render()
示例6: test_render
# 需要導入模塊: from pandas.formats.style import Styler [as 別名]
# 或者: from pandas.formats.style.Styler import render [as 別名]
def test_render(self):
df = pd.DataFrame({"A": [0, 1]})
style = lambda x: pd.Series(["color: red", "color: blue"], name=x.name)
s = Styler(df, uuid="AB").apply(style)
s.render()