pyspark.sql.functions.xpath_boolean#

pyspark.sql.functions.xpath_boolean(xml, path)[source]#

Returns true if the XPath expression evaluates to true, or if a matching node is found.

New in version 3.5.0.

Examples

>>> df = spark.createDataFrame([('<a><b>1</b></a>',)], ['x'])
>>> df.select(xpath_boolean(df.x, lit('a/b')).alias('r')).collect()
[Row(r=True)]