Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Support Stata variable labels #13536

Closed
TomAugspurger opened this issue Jun 30, 2016 · 0 comments
Closed

ENH: Support Stata variable labels #13536

TomAugspurger opened this issue Jun 30, 2016 · 0 comments
Labels
Enhancement IO Stata read_stata, to_stata
Milestone

Comments

@TomAugspurger
Copy link
Contributor

TomAugspurger commented Jun 30, 2016

xref #13535 (comment)

cc @frehoy

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.

A possible API

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)
@TomAugspurger TomAugspurger added this to the 0.19.0 milestone Jun 30, 2016
@jreback jreback modified the milestones: 0.19.0, 0.20.0 Jul 13, 2016
bashtage added a commit to bashtage/pandas that referenced this issue Jul 15, 2016
Add support for writing variable labels
Fix documentation for to_stata
Clean up function name to improve readability

closes pandas-dev#13536
closes pandas-dev#13535
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement IO Stata read_stata, to_stata
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants