Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
Returns a float value, the value zero if no match is found, or NaN if a match is found but the value is non-numeric.
Syntax
from pyspark.sql import functions as sf
sf.xpath_float(xml, path)
Parameters
| Parameter | Type | Description |
|---|---|---|
xml |
pyspark.sql.Column or str |
XML column or column name. |
path |
pyspark.sql.Column or str |
XPath expression. |
Examples
from pyspark.sql import functions as sf
df = spark.createDataFrame([('<a><b>1</b><b>2</b></a>',)], ['x'])
df.select(sf.xpath_float(df.x, sf.lit('sum(a/b)'))).show()
+------------------------+
|xpath_float(x, sum(a/b))|
+------------------------+
| 3.0|
+------------------------+