当前位置: 首页>>代码示例>>Python>>正文


Python excel.CSSToExcelConverter方法代码示例

本文整理汇总了Python中pandas.io.formats.excel.CSSToExcelConverter方法的典型用法代码示例。如果您正苦于以下问题:Python excel.CSSToExcelConverter方法的具体用法?Python excel.CSSToExcelConverter怎么用?Python excel.CSSToExcelConverter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pandas.io.formats.excel的用法示例。


在下文中一共展示了excel.CSSToExcelConverter方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_css_to_excel_multiple

# 需要导入模块: from pandas.io.formats import excel [as 别名]
# 或者: from pandas.io.formats.excel import CSSToExcelConverter [as 别名]
def test_css_to_excel_multiple():
    convert = CSSToExcelConverter()
    actual = convert('''
        font-weight: bold;
        text-decoration: underline;
        color: red;
        border-width: thin;
        text-align: center;
        vertical-align: top;
        unused: something;
    ''')
    assert {"font": {"bold": True, "underline": "single", "color": "FF0000"},
            "border": {"top": {"style": "thin"},
                       "right": {"style": "thin"},
                       "bottom": {"style": "thin"},
                       "left": {"style": "thin"}},
            "alignment": {"horizontal": "center",
                          "vertical": "top"}} == actual 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:20,代码来源:test_to_excel.py

示例2: test_css_to_excel_bad_colors

# 需要导入模块: from pandas.io.formats import excel [as 别名]
# 或者: from pandas.io.formats.excel import CSSToExcelConverter [as 别名]
def test_css_to_excel_bad_colors(input_color):
    # see gh-18392
    css = ("border-top-color: {color}; "
           "border-right-color: {color}; "
           "border-bottom-color: {color}; "
           "border-left-color: {color}; "
           "background-color: {color}; "
           "color: {color}").format(color=input_color)

    expected = dict()

    if input_color is not None:
        expected["fill"] = {
            "patternType": "solid"
        }

    with tm.assert_produces_warning(CSSWarning):
        convert = CSSToExcelConverter()
        assert expected == convert(css) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:21,代码来源:test_to_excel.py

示例3: test_css_to_excel_bad_colors

# 需要导入模块: from pandas.io.formats import excel [as 别名]
# 或者: from pandas.io.formats.excel import CSSToExcelConverter [as 别名]
def test_css_to_excel_bad_colors(input_color):
    # see gh-18392
    css = ("border-top-color: {color}; "
           "border-right-color: {color}; "
           "border-bottom-color: {color}; "
           "border-left-color: {color}; "
           "background-color: {color}; "
           "color: {color}").format(color=input_color)

    expected = dict()

    if input_color is not None:
        expected["fill"] = {
            "patternType": "solid"
        }

    with catch_warnings(record=True):
        convert = CSSToExcelConverter()
        assert expected == convert(css) 
开发者ID:birforce,项目名称:vnpy_crypto,代码行数:21,代码来源:test_to_excel.py

示例4: test_css_to_excel

# 需要导入模块: from pandas.io.formats import excel [as 别名]
# 或者: from pandas.io.formats.excel import CSSToExcelConverter [as 别名]
def test_css_to_excel(css, expected):
    convert = CSSToExcelConverter()
    assert expected == convert(css) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:5,代码来源:test_to_excel.py

示例5: test_css_to_excel_inherited

# 需要导入模块: from pandas.io.formats import excel [as 别名]
# 或者: from pandas.io.formats.excel import CSSToExcelConverter [as 别名]
def test_css_to_excel_inherited(css, inherited, expected):
    convert = CSSToExcelConverter(inherited)
    assert expected == convert(css) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:5,代码来源:test_to_excel.py

示例6: test_css_to_excel_good_colors

# 需要导入模块: from pandas.io.formats import excel [as 别名]
# 或者: from pandas.io.formats.excel import CSSToExcelConverter [as 别名]
def test_css_to_excel_good_colors(input_color, output_color):
    # see gh-18392
    css = ("border-top-color: {color}; "
           "border-right-color: {color}; "
           "border-bottom-color: {color}; "
           "border-left-color: {color}; "
           "background-color: {color}; "
           "color: {color}").format(color=input_color)

    expected = dict()

    expected["fill"] = {
        "patternType": "solid",
        "fgColor": output_color
    }

    expected["font"] = {
        "color": output_color
    }

    expected["border"] = {
        k: {
            "color": output_color,
        } for k in ("top", "right", "bottom", "left")
    }

    with tm.assert_produces_warning(None):
        convert = CSSToExcelConverter()
        assert expected == convert(css) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:31,代码来源:test_to_excel.py


注:本文中的pandas.io.formats.excel.CSSToExcelConverter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。