snowflake.snowpark.functions.xpath_number¶

snowflake.snowpark.functions.xpath_number(col: Union[Column, str], path: str) → Column[source]¶

Extracts a numeric value from an XML column using an XPath expression.

Returns NULL if no matches are found or value cannot be converted to float.

Parameters:
  • col – Column containing XML data

  • path – XPath expression string

Example:

>>> df = session.create_dataframe([['<root><price>19.99</price></root>']], schema=['xml'])
>>> df.select(xpath_number('xml', '//price/text()').alias('price')).collect()
[Row(PRICE=19.99)]
Copy