简体   繁体   English

使用 Python 进行 Power bi

[英]Power bi with Python

I am currently working on power bi and try to use python script to edit query.我目前正在研究 power bi 并尝试使用 python 脚本来编辑查询。 I have python 3.10 installed in windows system and directed power bi to python file.我在 Windows 系统中安装了 python 3.10 并将 power bi 定向到 python 文件。 Just write a very simple code import pandas as pd.只需编写一个非常简单的代码 import pandas as pd 即可。 Power bi shows error below: please help me. Power bi 显示以下错误:请帮帮我。

enter code here
    DataSource.Error: ADO.NET: A problem occurred while processing your Python script. Here are the technical details: [Expression.Error] The number is out of range of a 64 bit 
  integer value.
   Details:
  DataSourceKind=Python
  DataSourcePath=Python
  Message=A problem occurred while processing your Python script. 
  Here are the technical details: [Expression.Error] The number is out of range of a 64 bit 
  integer value.
  ErrorCode=-2147467259
ExceptionType=Microsoft.PowerBI.Scripting.Python.Exceptions.PythonUnexpectedException

   

Can you show a snippet of your python code?你能展示一段你的python代码吗? Will make it easier to see where things are going wrong.将更容易看出哪里出了问题。 If not here are a few checks you can do to see if everything should work.如果没有,您可以进行一些检查,看看是否一切正常。

1: Does the table show any errors before the step where you use the Python scripts? 1:在您使用 Python 脚本的步骤之前,该表是否显示任何错误? If so python may throw some errors, as power bi dumps the table to a dataframe, if there are errors in it the dataframe won't now how to represent them.如果是这样,python 可能会抛出一些错误,因为 power bi 将表转储到数据帧,如果其中有错误,数据帧现在将不会如何表示它们。

2: It may be a good idea to test your python code in a seperate editor first ( So make a dummy Dataframe in place of your table with maybe a few rows, and make sure your scripts executes just fine ( may be good to use the most extreme values occuring in your table for your test case ) 2:首先在单独的编辑器中测试您的 Python 代码可能是个好主意(因此,制作一个虚拟 Dataframe 来代替您的表格,其中可能有几行,并确保您的脚本执行得很好(使用测试用例表中出现的最极端值)

3: Make sure to store your desired result in a pandas dataframe. 3:确保将您想要的结果存储在熊猫数据框中。 Power BI takes all Dataframe objects in your script after executing, and allows you to dump them into a power query table. Power BI 在执行后获取脚本中的所有 Dataframe 对象,并允许你将它们转储到 Power 查询表中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM