小编Gue*_*est的帖子

xpath 在一次调用中解析多个值

如何在一次调用中获取多个路径的 xPath 值。

例如

<Message version="010" release="006"  xmlns="http://www.ncpdp.org/schema/SCRIPT" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Header>
</Header>
<Body>
    <CommunicationNumbers>
        <Communication>
            <Number>5551234444</Number>
            <Qualifier>TE</Qualifier>
        </Communication>
        <Communication>
            <Number>5551235555</Number>
            <Qualifier>FX</Qualifier>
        </Communication>
    </CommunicationNumbers>
    <Identification>
        <FileID>616</FileID>
        <DEANumber>AB123456</DEANumber>
        <SocialSecurity>123456789</SocialSecurity>
    </Identification>
    <Specialty>A</Specialty>
    <ClinicName>Therapy Department</ClinicName>
    <Name>
        <LastName>Xavior</LastName>
        <FirstName>Charles</FirstName>
        <MiddleName>C</MiddleName>
        <Suffix>MD</Suffix>
    </Name>
    <Address>
        <AddressLine1>888 ABC Drive</AddressLine1>
        <AddressLine2>Suite 200</AddressLine2>
        <City>Miami</City>
        <State>FL</State>
        <ZipCode>12345</ZipCode>
    </Address>
</Body>
Run Code Online (Sandbox Code Playgroud)

我需要以下值:

:通讯/号码 :身份/文件ID :专业

在一次通话中。

对于我正在使用的单个值

 public static String getExpValue(final String xmlString, final String expression, final ServiceNamespaceContext nameSpace) throws XPathExpressionException {
    StringReader strReader = new StringReader(xmlString);
    InputSource inputStr = new InputSource(strReader);
    String result …
Run Code Online (Sandbox Code Playgroud)

java xml xpath

6
推荐指数
1
解决办法
5046
查看次数

如何根据sklearn中的列值拆分数据

我有一个包含以下列的数据文件

'customer', 'calibrat' - 校准样本 = 1; 验证样本 = 0; 'churn', 'churndep', '收入', 'mou',

数据文件包含大约 40000 行,其中 20000 行的校准值为 1。我想将此数据拆分为

X1 = data.loc[:, data.columns != 'churn']
y1 = data.loc[:, data.columns == 'churn']
from imblearn.over_sampling import SMOTE
os = SMOTE(random_state=0)
X1_train, X1_test, y1_train, y1_test = train_test_split(X1, y1, test_size=0.3, random_state=0)
Run Code Online (Sandbox Code Playgroud)

我想要的是,在我的 X1_train 中应该带有 calibrat =1 的校准数据,而在 X1_test 中应该带有用于验证的所有数据 calibrat = 0

python machine-learning logistic-regression train-test-split smote

5
推荐指数
1
解决办法
2452
查看次数