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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
jumarinb
Microsoft Employee
Microsoft Employee

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

Hello,

 

I can't figure this one out. I'm using Python on Power BI to do some data manipulation. My script runs fine in Jupyter notebook. Additionally, it runs fine in Power BI until I do a column assignment:

 

 

 

# 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.

 

 

 

If I do the last assignment to a vector of 1s, it's fine. If I comment out the last line, it's fine. Python environments are fine. Once I do the assignment, I get this:
 

DataSource.Error: ADO.NET: Python script error.
Traceback (most recent call last):
File "C:\Users\user\esl\lib\site-packages\pandas\core\indexes\base.py", line 2646, in get_loc
return self._engine.get_loc(key)
File "pandas\_libs\index.pyx", line 111, in pandas._libs.index.IndexEngine.get_loc
File "pandas\_libs\index.pyx", line 138, in pandas._libs.index.IndexEngine.get_loc
File "pandas\_libs\hashtable_class_helper.pxi", line 1619, in pandas._libs.hashtable.PyObjectHashTable.get_item
File "pandas\_libs\hashtable_class_helper.pxi", line 1627, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'Progress'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\user\esl\lib\site-packages\pandas\core\internals\managers.py", line 1071, in set
loc = self.items.get_loc(item)
File "C:\Users\user\esl\lib\site-packages\pandas\core\indexes\base.py", line 2648, in get_loc
return self._engine.get_loc(self._maybe_cast_indexer(key))
File "pandas\_libs\index.pyx", line 111, in pandas._libs.index.IndexEngine.get_loc
File "pandas\_libs\index.pyx", line 138, in pandas._libs.index.IndexEngine.get_loc
File "pandas\_libs\hashtable_class_helper.pxi", line 1619, in pandas._libs.hashtable.PyObjectHashTable.get_item
File "pandas\_libs\hashtable_class_helper.pxi", line 1627, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'Progress'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "PythonScriptWrapper.PY", line 30, in <module>
df_installed["Progress"] = progress
File "C:\Users\user\esl\lib\site-packages\pandas\core\frame.py", line 2938, in __setitem__
self._set_item(key, value)
File "C:\Users\user\esl\lib\site-packages\pandas\core\frame.py", line 3001, in _set_item
NDFrame._set_item(self, key, value)
File "C:\Users\user\esl\lib\site-packages\pandas\core\generic.py", line 3624, in _set_item
self._data.set(key, value)
File "C:\Users\user\esl\lib\site-packages\pandas\core\internals\managers.py", line 1074, in set
self.insert(len(self.items), item, value)
File "C:\Users\user\esl\lib\site-packages\pandas\core\internals\managers.py", line 1181, in insert
block = make_block(values=value, ndim=self.ndim, placement=slice(loc, loc + 1))
File "C:\Users\user\esl\lib\site-packages\pandas\core\internals\blocks.py", line 3053, in make_block
return klass(values, ndim=ndim, placement=placement)
File "C:\Users\user\esl\lib\site-packages\pandas\core\internals\blocks.py", line 124, in __init__
raise ValueError(
ValueError: Wrong number of items passed 3, placement implies 1

Details:
DataSourceKind=Python
DataSourcePath=Python
Message=Python script error.
Traceback (most recent call last):
File "C:\Users\user\esl\lib\site-packages\pandas\core\indexes\base.py", line 2646, in get_loc
return self._engine.get_loc(key)
File "pandas\_libs\index.pyx", line 111, in pandas._libs.index.IndexEngine.get_loc
File "pandas\_libs\index.pyx", line 138, in pandas._libs.index.IndexEngine.get_loc
File "pandas\_libs\hashtable_class_helper.pxi", line 1619, in pandas._libs.hashtable.PyObjectHashTable.get_item
File "pandas\_libs\hashtable_class_helper.pxi", line 1627, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'Progress'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\user\esl\lib\site-packages\pandas\core\internals\managers.py", line 1071, in set
loc = self.items.get_loc(item)
File "C:\Users\user\esl\lib\site-packages\pandas\core\indexes\base.py", line 2648, in get_loc
return 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

Hi @jumarinb ,

 

Please refer to the case.

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

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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