How to Convert a dta file to csv without using STATA

Including Cython, Jython, IronPython, PyPy, Django framework, and interpreters: Ipython, IPython Jupyter/Notebook, CPython


Post Reply
User avatar
Eli
Senior Expert Member
Reactions: 183
Posts: 5334
Joined: 9 years ago
Location: Tanzania
Has thanked: 75 times
Been thanked: 88 times
Contact:

#1

We can easily convert the dta STATA file to csv without using STATA using Python Pandas as follows:

  1. import pandas as pd
  2. data = pd.io.stata.read_stata("https://stats.idre.ucla.edu/stat/data/ologit.dta")
  3. data.to_csv('your_stata_file.csv')

0
TSSFL -- A Creative Journey Towards Infinite Possibilities!
Post Reply

Return to “Python Programming”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 10 guests