You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a combined feature request & minor bug notice.
Feature Request: I would like to be able to write code that produces, byte-for-byte, reproducible outputs. To that end I want to write Stata dta files with a blank (or constant) timestamp. It would be nice to allow write_file() to accept a timestamp (or some option to zero it out).
Bug: In an attempt to do this myself, I made my own version of StataWriter.write_file() where the only difference is I call (underscore)write_header() internal function with a constant timestamp. But that produces the following bug.
importpandasaspdimportnumpyasnpfrompandas.io.stataimportStataWriterimportdatetimedf=pd.DataFrame(np.random.randn(6,4),index=list('abcdef'),columns=list('ABCD'))
writer=StataWriter('ouput.dta', df)
fktime_stamp=datetime.datetime.now()
writer._write_header(time_stamp=fktime_stamp)
# rest of write_file()
produces the following error
File "C:\Program Files\Python27\lib\site-packages\pandas\io\stata.py", line 1057, in _write_header
elif not isinstance(time_stamp, datetime):
TypeError: isinstance() arg 2 must be a class, type, or tuple of classes and types
@jreback I've put together a patch what will allow the time_stamp to be set from to_stata if there is any demand for this.
FWIW, this code is unreachable in normal use. There are a couple of other file properties that aren't exposed externally (e.g. an 80 character description string).
This is a combined feature request & minor bug notice.
Feature Request: I would like to be able to write code that produces, byte-for-byte, reproducible outputs. To that end I want to write Stata dta files with a blank (or constant) timestamp. It would be nice to allow write_file() to accept a timestamp (or some option to zero it out).
Bug: In an attempt to do this myself, I made my own version of StataWriter.write_file() where the only difference is I call (underscore)write_header() internal function with a constant timestamp. But that produces the following bug.
produces the following error
My system details are.
The text was updated successfully, but these errors were encountered: