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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
jumarinb
Microsoft Employee
Microsoft Employee

ExceptionType-Microsoft.PowerBI.Scripting.Python.Exceptions.PythonScriptRuntimeException

Hola

No puedo entender esto. Estoy usando Python en Power BI para hacer alguna manipulación de datos. Mi guión funciona bien en el cuaderno de Jupyter. Además, se ejecuta bien en Power BI hasta que realice una asignación de columna:

# Not a lot of code to get to this point
progress = df_installed.apply(lambda x: running_pct(x, deployment_totals), axis = 1)
# progress is a pd.Series with 141 float64 values
df_installed["Progress"] = progress
# If I comment this last line out, the script runs fine, but when I do the assignment, I get the error.

Si hago la última asignación a un vector de 1s, está bien. Si comento la última línea, está bien. Los entornos de Python están bien. Una vez que hago la tarea, entiendo esto:

DataSource.Error: ADO.NET: error de script de Python.
Traceback (última llamada más reciente):
Archivo "C:-Usuarios-usuario-esl-lib-paquetes-sitio-pandas-core-indexes-base.py", línea 2646, en get_loc
devolver self._engine.get_loc(clave)
Archivo "pandas-_libs-index.pyx", línea 111, en pandas._libs.index.IndexEngine.get_loc
Archivo "pandas-_libs-index.pyx", línea 138, en pandas._libs.index.IndexEngine.get_loc
Archivo "pandas-_libs-hashtable_class_helper.pxi", línea 1619, en pandas._libs.hashtable.PyObjectHashTable.get_item
Archivo "pandas-_libs-hashtable_class_helper.pxi", línea 1627, en pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'Progreso'

Durante el control de la excepción anterior, se produjo otra excepción:

Traceback (última llamada más reciente):
Archivo "C:-Usuarios-usuario-esl-lib-paquetes-sitio-pandas-core-internals-managers.py", línea 1071, en el conjunto
loc á self.items.get_loc(item)
Archivo "C:-Usuarios-usuario-esl-lib-paquetes-sitio-pandas-core-indexes-base.py", línea 2648, en get_loc
retorno self._engine.get_loc(self._maybe_cast_indexer(key))
Archivo "pandas-_libs-index.pyx", línea 111, en pandas._libs.index.IndexEngine.get_loc
Archivo "pandas-_libs-index.pyx", línea 138, en pandas._libs.index.IndexEngine.get_loc
Archivo "pandas-_libs-hashtable_class_helper.pxi", línea 1619, en pandas._libs.hashtable.PyObjectHashTable.get_item
Archivo "pandas-_libs-hashtable_class_helper.pxi", línea 1627, en pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'Progreso'

Durante el control de la excepción anterior, se produjo otra excepción:

Traceback (última llamada más reciente):
Archivo "PythonScriptWrapper.PY", línea 30, en <module>
df_installed["Progreso"] - Progreso
Archivo "C:-Usuarios-usuario-esl-lib-paquetes-sitio-pandas-core-frame.py", línea 2938, en __setitem__
self._set_item(clave, valor)
Archivo "C:-Usuarios-usuario-esl-lib-paquetes-sitio-pandas-core-frame.py", línea 3001, en _set_item
NDFrame._set_item(self, key, value)
Archivo "C:-Usuarios-usuario-esl-lib-paquetes-sitio-pandas-core-generic.py", línea 3624, en _set_item
self._data.set(clave, valor)
Archivo "C:-Usuarios-usuario-esl-lib-paquetes-sitio-pandas-core-internals-managers.py", línea 1074, en el conjunto
self.insert(len(self.items), item, value)
Archivo "C:-Usuarios-usuario-esl-lib-paquetes-sitio-pandas-core-internals-managers.py", línea 1181, en la inserción
bloque de make_block (valores-valor, ndim-self.ndim, placement-slice(loc, loc + 1))
Archivo "C:-Usuarios-usuario-esl-lib-paquetes-sitio-pandas-core-internals-blocks.py", línea 3053, en make_block
devolver klass(valores, ndim-ndim, placement-placement)
Archivo "C:-Usuarios-usuario-esl-lib-paquetes-sitio-pandas-core-internals-blocks.py", línea 124, en __init__
elevar ValueError(
ValueError: Número incorrecto de elementos pasados 3, la colocación implica 1

Detalles:
DataSourceKind-Python
DataSourcePath-Python
Error de secuencia de comandos Message-Python.
Traceback (última llamada más reciente):
Archivo "C:-Usuarios-usuario-esl-lib-paquetes-sitio-pandas-core-indexes-base.py", línea 2646, en get_loc
devolver self._engine.get_loc(clave)
Archivo "pandas-_libs-index.pyx", línea 111, en pandas._libs.index.IndexEngine.get_loc
Archivo "pandas-_libs-index.pyx", línea 138, en pandas._libs.index.IndexEngine.get_loc
Archivo "pandas-_libs-hashtable_class_helper.pxi", línea 1619, en pandas._libs.hashtable.PyObjectHashTable.get_item
Archivo "pandas-_libs-hashtable_class_helper.pxi", línea 1627, en pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'Progreso'

Durante el control de la excepción anterior, se produjo otra excepción:

Traceback (última llamada más reciente):
Archivo "C:-Usuarios-usuario-esl-lib-paquetes-sitio-pandas-core-internals-managers.py", línea 1071, en el conjunto
loc á self.items.get_loc(item)
Archivo "C:-Usuarios-usuario-esl-lib-paquetes-sitio-pandas-core-indexes-base.py", línea 2648, en get_loc
retorno self._engine.get_loc(self._maybe_cast_in...
ErrorCode-2147467259
ExceptionType-Microsoft.PowerBI.Scripting.Python.Exceptions.PythonScriptRuntimeException

1 REPLY 1
v-lionel-msft
Community Support
Community Support

Hola @jumarinb ,

Por favor refiérase al caso.

Microsoft.PowerBI.Scripting.Python.Exceptions.PythonScriptRuntimeException-Transforming data python

Saludos
Lionel Chen

Si este post ayuda,entonces considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.