stata调用python函数,利用函数返回值
//stata调用python,引用py文件中的函数 //stata中设置python路径 set python_exec d:\python37\python.exe //stata中调用python python //引入函数 from myfunction1 import add_numbers //调用函数 add_numbers(3, 4) //从python返回到stata end //在stata中显示变量的值 disp result //在stata中打开表 webuse auto,clear //增加变量ab,其值是python返回的值 gen ab=result //stata中手工输入python代码 python: from sfi import Scalar def calcsum(sum1, sum2): res = sum1 + sum2 Scalar.setValue("result", res) calcsum(7, 4) end disp result webuse auto,clear gen aa=result //stata中检索python的安装路径 python search // --------------------------------------------------------------------------------------------------------------------- // Python environments found: // D:\Python38\python.exe // D:\Python37\python.exe // -------------------------------------------------------------------------------------------------------------------- //stata查询python相关信息 python query // --------------------------------------------------------------------------------------------------------------------- // Python Settings // set python_exec d:\python37\python.exe // set python_userpath // // Python system information // initialized yes // version 3.7.0 // architecture 64-bit // library path d:\python37\python37.dll //stata中清除python的变量及函数 python clear //在STATA中显示python设置的变量及函数 python des // add_numbers: // <function add_numbers at 0x0000000006BAB950> // // result: // 7
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
2022-03-18 微信群 共享文档 在线编辑
2022-03-18 python替换开头的连续字符 替换连续的几个字符
2021-03-18 C语言:宏完美定义
2020-03-18 CPU 几核
2020-03-18 python 进程