ENH: Support Stata variable labels · Issue #13536 · pandas-dev/pandas (original) (raw)

It seems that is is almost implemented here.

See
https://github.com/pydata/pandas/blob/master/pandas/io/stata.py#L2057

and

https://github.com/pydata/pandas/blob/master/pandas/io/stata.py#L2134

As you can see, this always passes the default None and so no labels are written.

Mostly needs an external interface and a tiny amount of wiring up. And testing, esp that the labels can be read into Stata.

import pandas as pd d = {'one' : [1., 2., 3., 4.]} df = pd.DataFrame(d) labdict = {'one': 'foo'} df.to_stata('test.dta', write_index=False, variab_labels=labdict)