python - Loading STATA file: Categorial values must be unique -
i trying load .dta
file behind zip file pandas
. however, error. have stata @ command, since error message doesn't tell me more, faulty column, have no clue do.
how can load file 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 unique') valueerror: categorical categories must unique
load pandas.read_stata('cepr_org_2014.dta', convert_categoricals=false, convert_missing=true)
, have @ data looks like. optionally debugging ipdb commented in question shows there's duplicate category in data.
Comments
Post a Comment