-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Enable stata files to be written to buffers #21169
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
Conversation
c0b23e2
to
e841df1
Compare
Codecov Report
@@ Coverage Diff @@
## master #21169 +/- ##
=======================================
Coverage 91.84% 91.84%
=======================================
Files 153 153
Lines 49505 49505
=======================================
Hits 45466 45466
Misses 4039 4039
Continue to review full report at Codecov.
|
pandas/io/stata.py
Outdated
@@ -2205,7 +2220,13 @@ def write_file(self): | |||
self._write_file_close_tag() | |||
self._write_map() | |||
finally: | |||
self._file.close() | |||
try: |
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.
can you move to a close method (or _close if needed), or is this the only place where things are needing to be closed? can you add some comments
doc/source/whatsnew/v0.23.1.txt
Outdated
@@ -81,7 +81,7 @@ Indexing | |||
I/O | |||
^^^ | |||
|
|||
- | |||
- Bug in :meth:`DataFrame.to_stata` which prevented buffers from being directly written to (:issue:`21041`) |
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.
can you be slightly more descriptive here
@@ -1473,3 +1474,17 @@ def test_invalid_date_conversion(self): | |||
with pytest.raises(ValueError): | |||
original.to_stata(path, | |||
convert_dates={'wrong_name': 'tc'}) | |||
|
|||
@pytest.mark.parametrize('version', [114, 117]) |
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.
it is worthwhile a replication of the OP?
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.
I added this.
e841df1
to
1a83312
Compare
@jreback I think I got them all. |
Enable support for general file-like objects when exporting stata files closes pandas-dev#21041
1a83312
to
e4a66f0
Compare
thanks @bashtage always nice to have PRs from you! |
@jorisvandenbossche looks like master broke on geopandas test? https://travis-ci.org/pandas-dev/pandas/jobs/383432151 |
No, nothing pandas related, "just" conda forge dependency problems |
Enable support for general file-like objects when exporting stata files closes pandas-dev#21041 (cherry picked from commit f91e28c)
Enable support for general file-like objects when exporting stata files closes pandas-dev#21041
Enable support for general file-like objects when exporting stata files
git diff upstream/master -u -- "*.py" | flake8 --diff