Skip to content

Conversation

bashtage
Copy link
Contributor

Enable support for general file-like objects when exporting stata files

@bashtage bashtage force-pushed the stata-buffer-fix branch 2 times, most recently from c0b23e2 to e841df1 Compare May 22, 2018 09:19
@codecov
Copy link

codecov bot commented May 22, 2018

Codecov Report

Merging #21169 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #21169   +/-   ##
=======================================
  Coverage   91.84%   91.84%           
=======================================
  Files         153      153           
  Lines       49505    49505           
=======================================
  Hits        45466    45466           
  Misses       4039     4039
Flag Coverage Δ
#multiple 90.23% <ø> (ø) ⬆️
#single 41.88% <ø> (ø) ⬆️
Impacted Files Coverage Δ
pandas/core/frame.py 97.22% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1abfd1b...e4a66f0. Read the comment docs.

@jschendel jschendel added Bug IO Stata read_stata, to_stata labels May 22, 2018
@@ -2205,7 +2220,13 @@ def write_file(self):
self._write_file_close_tag()
self._write_map()
finally:
self._file.close()
try:
Copy link
Contributor

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

@@ -81,7 +81,7 @@ Indexing
I/O
^^^

-
- Bug in :meth:`DataFrame.to_stata` which prevented buffers from being directly written to (:issue:`21041`)
Copy link
Contributor

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])
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this.

@jreback jreback added this to the 0.23.1 milestone May 23, 2018
@bashtage bashtage force-pushed the stata-buffer-fix branch from e841df1 to 1a83312 Compare May 24, 2018 08:19
@bashtage
Copy link
Contributor Author

@jreback I think I got them all.

Enable support for general file-like objects when exporting stata files

closes pandas-dev#21041
@bashtage bashtage force-pushed the stata-buffer-fix branch from 1a83312 to e4a66f0 Compare May 24, 2018 08:27
@jreback jreback merged commit f91e28c into pandas-dev:master May 24, 2018
@jreback
Copy link
Contributor

jreback commented May 24, 2018

thanks @bashtage

always nice to have PRs from you!

@jreback
Copy link
Contributor

jreback commented May 24, 2018

@jorisvandenbossche looks like master broke on geopandas test? https://travis-ci.org/pandas-dev/pandas/jobs/383432151

@bashtage bashtage deleted the stata-buffer-fix branch May 25, 2018 06:37
@jorisvandenbossche
Copy link
Member

@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

jorisvandenbossche pushed a commit to jorisvandenbossche/pandas that referenced this pull request Jun 8, 2018
Enable support for general file-like objects when exporting stata files

closes pandas-dev#21041
(cherry picked from commit f91e28c)
jorisvandenbossche pushed a commit that referenced this pull request Jun 9, 2018
Enable support for general file-like objects when exporting stata files

closes #21041
(cherry picked from commit f91e28c)
david-liu-brattle-1 pushed a commit to david-liu-brattle-1/pandas that referenced this pull request Jun 18, 2018
Enable support for general file-like objects when exporting stata files

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

Successfully merging this pull request may close these issues.

Trouble writing to_stata with a GzipFile
5 participants