Download STATA file: categorical values ββmust be unique
I am trying to download the file .dta
behind this zip file into pandas
. However, I get the error immediately. I also have stata on my command, but since the error message doesn't tell me anything else, like the erroneous column, I don't know what to do.
How do I upload a file to pandas
?
>>> df = pd.read_stata('cepr_org_2014.dta')
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/usr/local/Cellar/python/2.7.8_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas-0.15.2-py2.7-macosx-10.9-x86_64.egg/pandas/io/stata.py", line 69, in read_stata
order_categoricals)
File "/usr/local/Cellar/python/2.7.8_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas-0.15.2-py2.7-macosx-10.9-x86_64.egg/pandas/io/stata.py", line 1315, in data
cat_data.categories = categories
File "/usr/local/Cellar/python/2.7.8_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas-0.15.2-py2.7-macosx-10.9-x86_64.egg/pandas/core/categorical.py", line 442, in _set_categories
categories = self._validate_categories(categories)
File "/usr/local/Cellar/python/2.7.8_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas-0.15.2-py2.7-macosx-10.9-x86_64.egg/pandas/core/categorical.py", line 437, in _validate_categories
raise ValueError('Categorical categories must be unique')
ValueError: Categorical categories must be unique
+3
source to share