Python integration is one of the most exciting features in Stata 16. There are thousands of free Python packages that you can use to access and process data from the Internet, visualize data, explore data using machine-learning algorithms, and much more. You can use these Python packages interactively within Stata or incorporate Python code into your do-files. And there are a growing number of community-contributed commands that have familiar, Stata-style syntax that use Python packages as the computational engine. But there are a few things that we must do before we can use Python in Stata. This blog post will show you how to set up Stata to use Python.
Download and install Python
You may already have Python installed on your computer. You can check by typing python search in Stata.
The result tells us that no Python installations were found, so I will need to install Python. You may need to consult your system administrator if you are not the owner or administrator of the computer you are using.
You can download an installation file for Python at the Python download website. Python is available for Linux, Mac, and Windows, so you should select the installation file that corresponds to your operating system. You should select a 64-bit installation file because Stata/Python integration works only with 64-bit processors. Python 3.8.5 is the current version as I am writing this post, and I recommend using the latest version. Older versions of Python are available for download if you need them for backward compatibility, but versions older than Python 3.0 have now reached “end of life” status.
After you download the installation file, simply run it and follow the setup instructions. I have recorded a video that shows how to download and install Python for Windows 10 on a 64-bit computer.
Download and install Anaconda/Python
Python is also included in an open-source development environment called Anaconda. Many people prefer Anaconda because it automatically installs and manages many Python packages during installation. You can download the appropriate Anaconda installation file at the Anaconda download website. Anaconda is also available for Linux, Mac, and Windows, and you should select the 64-bit installation file that corresponds to your operating system. After you download the installation file, simply run it and follow the setup instructions. I have recorded a video that shows how to download and install Anaconda for Windows 10 on a 64-bit computer.
Setting up Stata to use Python
After you install Python or Anaconda, or both, on your computer, you can return to Stata and again type python search in the Command window.
I have installed both Python 3.8 and Anaconda 3.0 on my computer. I can tell Stata which Python installation I wish to use with the set python_exec command. The example below tells Stata that I wish to use Python 3.8.
You can type python query to see which Python installation you are currently using.
You can use set python_userpath to set additional paths for Python to look up packages and modules that you create or download. The example below uses set python_userpath to add the folder where I save my personal Python modules.
You can type python query to see which Python installation you are currently using.
Now we’re ready to use Python within Stata! You can begin using Python interactively by typing python in the Command window. Stata will remind you that you can type end to exit Python and return to Stata. The example below uses Python to print() the sentence “Hello Stata, I am Python” to the screen.
It worked! This blog post is the first in a series that I am writing to show you how to use Python within Stata. My goal is to provide a basic foundation so that you will have the skills to explore Python packages that are useful to you. This post demonstrated how to install Python and set up Stata to use Python. In my next post, I will demonstrate several ways to use Python from within Stata.
近期,武漢大學(xué)經(jīng)濟與管理學(xué)院聯(lián)合Stata軟件中國授權(quán)經(jīng)銷商北京天演融智軟件有限公司(科學(xué)軟件網(wǎng))在七-八月份舉辦Stata系列專題講座以及Stata軟件研討會,得到了大家的一致**。在此,科學(xué)軟件網(wǎng)為大家提供三場講座的回放以及“Stata洞察數(shù)據(jù)科學(xué)研討會” 中李春濤老師主講的主題為 “中文地圖與Stata” 和 肖光恩老師主講的主題為 “新冠疫情數(shù)據(jù)的可視化與建模方法” 的演講回放視頻,全部免費,可直接掃碼(頁面下方直接點 試聽 )免費觀看。
北京天演融智軟件有限公司(科學(xué)軟件網(wǎng))是Stata軟件在中國的授權(quán)經(jīng)銷商,為中國的Stata用戶提供優(yōu)質(zhì)的軟件銷售和培訓(xùn)服務(wù)。
詞條
詞條說明
好課免費享|SPSS統(tǒng)計分析及初中級應(yīng)用培訓(xùn)課程
SPSS Statistics是**良好的統(tǒng)計分析軟件。IBM SPSS軟件平臺提供**統(tǒng)計分析、豐富的機器學(xué)習(xí)算法、文本分析、開源可擴展性、與大數(shù)據(jù)的集成以及無縫部署到應(yīng)用程序中等功能。是一款再調(diào)查統(tǒng)計行業(yè)、市場研究行業(yè)、醫(yī)學(xué)統(tǒng)計、**和企業(yè)的數(shù)據(jù)分析應(yīng)用中久負(fù)盛名的統(tǒng)計分析工具。IBM SPSS兼具易用性、靈活性和可擴展性,可以為具有各種技能水平的用戶提供服務(wù),并且?guī)椭湍钠髽I(yè)發(fā)現(xiàn)新機遇,
案例分享 | DecisionTools和@RISK的簡單易用大大提高了交大師生們的研究效率
上海交通大學(xué)密西根學(xué)院開設(shè)了DecisionTools Suite及@RISK軟件課程,受到了學(xué)生們的歡迎,他們利用這些軟件和知識在相關(guān)課題研究和工程中獲得了大量的研究成果和數(shù)據(jù),并且相較使用這些軟件前節(jié)省了大量的時間和工作,較大地提高了效率。?DecisionTools及@RISK在上海交大得到成功運用?上海交通大學(xué)密西根學(xué)院在李冕教授的帶領(lǐng)下,開設(shè)了DecisionTool
Stata圖書推薦|Maximum Likelihood Estimation with Stata
Maximum Likelihood Estimation with Stata一書, 是各學(xué)科研究者在Stata中編寫較大似然(ML)估計量的重要參考和指南。除了全面介紹Stata編寫ML估計量的命令外,本書還概述了較大似然的基礎(chǔ)以及如何思考ML估計。*五版包含了新的*二章,該章演示了易于使用的mlexp命令。該命令允許您直接*似然函數(shù)并執(zhí)行估計,而*任何編程。?本書的**是Sta
HYDRUS模擬多孔介質(zhì)中水的流動和污染物的運移培訓(xùn)
HYDRUS是一個運行于Windows系統(tǒng)下的環(huán)境模擬軟件,主要用于變量飽和多孔介質(zhì)的水流和溶質(zhì)運移。HYDRUS包括用于模擬變量飽和多孔介質(zhì)下的水、熱和多溶質(zhì)運移的二維和三維有限元計算,包括一個參數(shù)優(yōu)化算法,用于各種土壤的水壓和溶質(zhì)運移參數(shù)的逆向估計。該模型互動的圖形界面,可進行數(shù)據(jù)前處理、結(jié)構(gòu)化和非結(jié)構(gòu)化的有限元網(wǎng)格生成以及結(jié)果的圖形展示?!禜YDRUS模型應(yīng)用**培訓(xùn)班》已經(jīng)在中國成功舉辦四
公司名: 北京天演融智軟件有限公司
聯(lián)系人: 張經(jīng)理
電 話:
手 機: 18610814366
微 信: 18610814366
地 址: 北京海淀海淀上地東路35號院1號樓3層1-312318、1-312-319
郵 編:
網(wǎng) 址: turntech88.b2b168.com
公司名: 北京天演融智軟件有限公司
聯(lián)系人: 張經(jīng)理
手 機: 18610814366
電 話:
地 址: 北京海淀海淀上地東路35號院1號樓3層1-312318、1-312-319
郵 編:
網(wǎng) 址: turntech88.b2b168.com