-
-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: Add support for writing variable labels to Stata files #13631
Conversation
b25d26c
to
e7a1e62
Compare
case the current time is used. | ||
dataset_label : str | ||
A label for the data set. Should be 80 characters or smaller. | ||
variable_labels : dict |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a note here about the variables needing to be latin-1 encodable? Also perhaps note that a ValueError is raised if not, or if any label is too long.
Just the one minor note, plus a whatsnew entry (this can go in 0.19). Other than that this looks great assuming Travis passes. |
It will fail on Python 2.7 I can see now. But should be easy enough to fix. |
e7a1e62
to
3ef8342
Compare
Current coverage is 84.38%@@ master #13631 diff @@
==========================================
Files 142 142
Lines 51223 51235 +12
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 43223 43235 +12
Misses 8000 8000
Partials 0 0
|
3ef8342
to
d4334f4
Compare
@@ -1113,6 +1113,56 @@ def test_read_chunks_columns(self): | |||
tm.assert_frame_equal(from_frame, chunk, check_dtype=False) | |||
pos += chunksize | |||
|
|||
def test_write_variable_labels(self): | |||
original = pd.DataFrame({'a': [1, 2, 3, 4], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add issue number
is this forward compat? IOW, righting the labels should then be readable by older versions of pandas? |
variable_labels : dict | ||
Dictionary containing columns as keys and variable labels as | ||
values. Each label must be 80 characters or smaller. Raises a | ||
ValueError if a label is too long or contains characters that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add versionadded tag
Should be -- the reader code always has to read these labels even if it doesn't do anything with them. One can read them using |
d4334f4
to
a93be07
Compare
@TomAugspurger @jreback Sort of unrelated issue, but do have any idea why my Travis fails when running pandas test suite? My travis always fails even when the pull request into pandas pydata travis works fine. Most recent example: https://travis-ci.org/bashtage/pandas/builds/144722347 I see lots of errors like:
|
@bashtage you have an older fork; git does not update tags with a fork (not really sure why this doesn't go along with cloning but it doesnt'). so
will push them up to your fork of master, so future branches should be ok there is a setup section that shows the gittags (after you update then this will show them) |
a93be07
to
c33c670
Compare
@jreback All green. |
encoding : str | ||
Default is latin-1. Note that Stata does not support unicode. | ||
byteorder : str | ||
Can be ">", "<", "little", or "big". The default is None which uses | ||
`sys.byteorder` | ||
time_stamp : datetime |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where these new entries just left out before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Arguments were present but uncodumented. Mentioned in one fo the issues this closes.
just some formatting changes. can you add a whatsnew entry as well. doc updates if you think are needed as well. ping on green. |
c33c670
to
4706e6d
Compare
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
4706e6d
to
1e1e1bf
Compare
@jreback Should be ready |
thanks @bashtage |
git diff upstream/master | flake8 --diff
Add support for writing variable labels
Fix documentation for to_stata
Clean up function name to improve readability
closes #13536
closes #13535