Pular para o conteúdo principal

traduzir

Os caracteres em replace correspondem aos caracteres em matching. A tradução ocorrerá sempre que qualquer caractere nas strings corresponder ao caractere em matching.

Para a função Databricks SQL correspondente, consulte a funçãotranslate.

Sintaxe

Python
from pyspark.databricks.sql import functions as dbf

dbf.translate(srcCol=<srcCol>, matching=<matching>, replace=<replace>)

Parâmetros

Parâmetro

Tipo

Descrição

srcCol

pyspark.sql.Column ou str

Coluna de origem ou strings

matching

str

caracteres correspondentes.

replace

str

caracteres para substituição. Se isso for menor que matching strings, os caracteres que não tiverem substituição serão descartados.

Devoluções

pyspark.sql.Column: valor substituído.

Exemplos

Python
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([('translate',)], ['a'])
df.select('*', dbf.translate('a', "rnlt", "123")).show()