pandas can not load Stata 16 data
See original GitHub issueCode Sample
df = pd.read_stata('xx.dta')
Problem description
I was trying to use the above command to load Stata 16 data, but got an error saying
Version of given Stata file is not 104, 105, 108, 111 (Stata 7SE), 113 (Stata 8/9), 114 (Stata 10/11), 115 (Stata 12), 117 (Stata 13), or 118 (Stata 14)
I updated pandas to version 0.25.1, the issue persists. How could I load Stata 16 data without degrading the dataset? Thanks.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
unable to read stata .dta file in python - pandas - Stack Overflow
Just use the read_table() of Pandas then make sure to include delim_whitespace=True and header=None.
Read more >Python Integration: Pandas Package Causing Stata to Close
I have a recent version of Anaconda installed, and Stata is recently updated. However, when I try to load a Stata dataset into...
Read more >Unable to import Stata 13 database files with read_stata() #7360
pandas v0.14.0 (May 31 , 2014) seems uncapable of importing Stata 13 datasets although according to this http://pandas.pydata.org/pandas-docs/ ...
Read more >Stata/Python integration part 4: How to use Python packages
pandas is a popular Python package used for importing, exporting, and manipulating data. The package contains different modules for working ...
Read more >Data (sfi.Data) — Python API documentation for Stata 16
Here nvar is the number of variables defined in the dataset currently loaded in Stata, which is returned by getVarCount() . nobs is...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@gfyoung I would like to, but the .dta is a large file (~500M) with 38548 variables (columns), and I figured out that I was wrong. I extracted a subset from the file and loaded it to pandas dataframe successfully. I guess the numbers of columns are an issue, not the Stata version.
@shuai-zhou I was wrong – 119 are supported. So if you cannot import your file, we should try to figure out why.
Could you make a very small version to share – perhaps with a few observations?