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.
See also
pyspark.sql.functions.from_xml()pyspark.sql.functions.schema_of_xml()pyspark.sql.functions.to_xml()pyspark.sql.functions.xpath()pyspark.sql.functions.xpath_double()pyspark.sql.functions.xpath_float()pyspark.sql.functions.xpath_int()pyspark.sql.functions.xpath_long()pyspark.sql.functions.xpath_number()pyspark.sql.functions.xpath_short()pyspark.sql.functions.xpath_string()
Examples
>>> from pyspark.sql import functions as sf >>> df = spark.createDataFrame([('<a><b>1</b></a>',)], ['x']) >>> df.select(sf.xpath_boolean(df.x, sf.lit('a/b'))).show() +---------------------+ |xpath_boolean(x, a/b)| +---------------------+ | true| +---------------------+