Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hello,
I'm encountering an out of memory error when trying to run a Python script within Power BI to manipulate a dataset. I aim to truncate a dataset to only the first 5 rows using a Python script step in the Power Query Editor. Here's the script I am using:
import pandas as pd
# 'dataset' holds the input data for this script
# Keep only the first 5 rows
dataset = dataset.head(5)
However, when I execute the script, I receive the following error message:
DataSource.Error: ADO.NET: Python script error.
pandas.errors.ParserError: Error tokenizing data. C error: out of memory
Details:
DataSourceKind=Python
DataSourcePath=Python
Message=Python script error.
ErrorCode=-2147467259
ExceptionType=Microsoft.PowerBI.Scripting.Python.Exceptions.PythonScriptRuntimeException
The dataset is not particularly large, so it's puzzling why this memory issue arises. I've tried to ensure that my system has enough available memory and even filtered the dataset in Power Query before handing it off to Python, but to no avail.
Has anyone faced a similar issue or can offer insights into what might be going wrong? Any advice on how to troubleshoot this error would be greatly appreciated.
Thank you in advance for your help!
Hi @HamidBee
I found something related to your problem and you can try the methods mentioned in it.
Error tokenizing data. C error: out of memory pandas python, large file csv - Stack Overflow
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
96 | |
69 | |
45 | |
39 | |
30 |
User | Count |
---|---|
155 | |
96 | |
60 | |
42 | |
41 |