PowerBI没有将数据字段传递给Python脚本

我试图在PowerBI中运行一个简单的Python脚本以使其正常运行,但是它只会出现很多错误。我试图:

  1. 重新安装Numpy和Matplotlib。
  2. 使用Python 3.5和3.6尝试
  3. 卸载Conda并重新安装

我有一个屏幕截图显示了我的问题(所有内容都在一个屏幕下面)。对于x和y,标记为“标签”和“数据”的数据仅为a,b,c和1,2,3。

Screen shot of error and code

此处的代码:

# The following code to create a dataframe and remove duplicated rows is always executed and acts as 
a preamble for your script: 
dataset = pandas.DataFrame(Data,Label)
# dataset = dataset.drop_duplicates()

# Paste or type your script code here:

import matplotlib.pyplot as plt 
dataset.plot(kind='scatter',x='Label',y='Data',color='red')
plt.show() 
cairuojin 回答:PowerBI没有将数据字段传递给Python脚本

您需要注释掉以下内容:

dataset = pandas.DataFrame(Data,Label)

https://cffiddle.org/app/file?filepath=e3d24147-8a25-44ff-a98d-5b1e686cd619/d6115113-eead-4214-bc94-13eb7f0456f5/efad9206-b082-4940-bf5d-f4c5001ae2ec.cfm

即使已被“注释掉”,它也会运行。只是为可视化设置了数据框架,这是一个不起作用的示例,如果未注释掉,则为

Working example

希望有帮助

本文链接:https://www.f2er.com/3130271.html

大家都在问