Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Syndicate_Admin
Administrator
Administrator

Traducir una columna con Python usando la biblioteca de blobs de texto

¡Hola!

Estoy tratando de traducir una columna de mi tabla, usando la biblioteca TextBlob de Python. Este es mi código.

desde Textblob importar TextBlob

def traducción (texto):
blob = TextBlob(texto)
return str(blob.translate(from_lang = 'pt', to = 'en'))

dataset['translation'] = dataset['CardDescription'].apply(translation)

Genera el siguiente error.

TypeError: El argumento 'text' pasado a '__init__(text)' debe ser una cadena, no

vgferreira_1-1669231586399.png

sin embargo, mi columna CardDescription tiene el formato de texto.

vgferreira_3-1669231898588.png


Lo probé usando una variable de cadena y funcionó.

No sé el motivo del error, ¿alguien puede ayudarme?

¡Gracias de antemano!

1 REPLY 1
Syndicate_Admin
Administrator
Administrator

Hi, @vgferreira

Este es un mensaje de error relacionado con el script de python, no con powerbi.

Debe verificar la codificación que está utilizando para su archivo.

Referencia:

TextBlob --- El argumento 'text' pasado a '__init__(text)' debe ser una cadena, no

Python 2.7 y Textblob - TypeError: El argumento 'text' pasado a '__init__(text)' debe ser una cadena...

Saludos
Equipo de Apoyo a la Comunidad _ Eason

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Kudoed Authors