如何将数据帧传递为机器人文件中的参数?
我将数据帧传递到类方法,当我运行PY文件时,其工作正常。但是当我在机器人中调用该方法时,我会遇到错误,因为“字符串索引必须是整数”。以下是参考的代码。
python文件(虚拟)
class Dummy:
def case1(self,df1,df2):
#operation
#reading file and creating dataframe here
obj=Dummy()
obj.case1(df1,df2)
机器人文件
*** Settings ***
Library Dummy.py
*** Test Cases ***
Example
${result}= Dummy.case1 df1 df2
I am passing dataframe to class method and when I run py file its working fine.But when I call that method in robot I am getting error as "string indices must be integers". below is the code for ref.
python file(Dummy.py)
class Dummy:
def case1(self,df1,df2):
#operation
#reading file and creating dataframe here
obj=Dummy()
obj.case1(df1,df2)
robot file
*** Settings ***
Library Dummy.py
*** Test Cases ***
Example
${result}= Dummy.case1 df1 df2
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以像其他任何变量一样传递数据帧。无需对其进行任何不同。这里的重要问题是您是如何创建它的?真的是数据框架吗?
下面的示例应起作用:
.py
机器人
You can pass dataframe as you would any other variable. There is no need to treat it any different. Important question here is how did you create it? Was it realy a dataframe?
below example should work:
.py
robot
我能够使用变量文件为Pyspark DataFrame做到这一点。
您可以创建一个变量文件,并创建一个数据框作为该文件中的变量,然后从.robot文件
变量。
调用
I was able to do it for pyspark dataframe using variables files.
You can create a variable file and create a dataframe as a variable in that file and then call the variable from .robot file..
Example myvariables.py
Exmaple .ROBOT file