小编Ste*_*DEU的帖子

Python Pandas:突出显示匹配的文本和行

I\xe2\x80\x99m 尝试将 df1 中与 df3 中的值匹配的任何字符串的字体颜色更改为红色并突出显示该行。我找不到任何有关更改字体颜色的信息。数据集是:

\n\n
df1 = [ \xe2\x80\x98i like to shop at store a.\xe2\x80\x99 , \xe2\x80\x98he likes to shop at the store b.\xe2\x80\x99, \xe2\x80\x98she is happy to shop at store c.\xe2\x80\x99, \'we want to shop at the store d.\']\ndf2 = [ \xe2\x80\x98store a\xe2\x80\x99, \xe2\x80\x98store b\xe2\x80\x99, \xe2\x80\x98store c\xe2\x80\x99, \'store d\' ]\ndf3 = [ \xe2\x80\x98like to\xe2\x80\x99, \xe2\x80\x98likes to shop\xe2\x80\x99, \xe2\x80\x98at store\xe2\x80\x99 ]\n
Run Code Online (Sandbox Code Playgroud)\n\n

我正在使用以下内容:

\n\n
myDataSet = list(zip(df1,df2))\ndf = pd.DataFrame(data = myDataSet, columns=[\xe2\x80\x98df1\xe2\x80\x99, \xe2\x80\x98df2\xe2\x80\x99]\n
Run Code Online (Sandbox Code Playgroud)\n\n

输出应如下所示:

\n\n

在此输入图像描述

\n\n

请帮忙! …

python pandas

7
推荐指数
2
解决办法
8067
查看次数

XSLT XML:突出显示搜索结果中的搜索词

这是 XML:

<?xml version="1.0" encoding="UTF-8"?>
    <file>
        <text>
            <p>
               <sentence>I bought kiwi at the grocery store.</sentence>
               <sentence>I also bought bananas at the store.</sentence>
               <sentence>Then, I bought a basket at another store.</sentence>
            </p>
            <p>
                <sentence>You bought kiwi at the grocery store.</sentence>
                <sentence>You also bought bananas at the store.</sentence>
                <sentence>Then, You bought a basket at another store.</sentence>
            </p>
        </text>
    </file>
Run Code Online (Sandbox Code Playgroud)

这是 XSLT:

<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="sentence">
        <p>
            <xsl:apply-templates/>
        </p>
    </xsl:template>
        <xsl:template match="/">
        <html>
            <body>
                <xsl:apply-templates select="file/text/p/sentence[contains(.,$search)]"/>
            </body>
        </html>
    </xsl:template>
</xsl:stylesheet>
Run Code Online (Sandbox Code Playgroud)

我需要$search …

xml xslt

3
推荐指数
1
解决办法
896
查看次数

标签 统计

pandas ×1

python ×1

xml ×1

xslt ×1