-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
ENH: Add uint and bool support in to_stata #7726
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
we'll just call you mr. stata from now on :) can you move the release note to 0.15.0.txt (0.14.1 coming tomorrow), so too late for that |
I think this is ready. |
upcast if needed. int64 data is not usable in Stata, and so it is | ||
downcast to int32 whenever the value are in the int32 range, and | ||
sidecast to float64 when larger than this range. If the int64 values | ||
are outside of the range of those perfectly representable as float64 values, | ||
a warning is raised. | ||
|
||
bool columns are cast to int8. uint colums are converted to int of the same |
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 add a note to the io.rst stata section explaining on dtype conversion works with the various types?
@jreback I added some docs. |
@@ -3504,6 +3504,28 @@ into a .dta file. The format version of this file is always 115 (Stata 12). | |||
df = DataFrame(randn(10, 2), columns=list('AB')) | |||
df.to_stata('stata.dta') | |||
|
|||
Stata data files have limited data type support and only strings with 244 or | |||
fewer characters, ``int8``, ``int16``, ``int32`` and ``float64`` can written | |||
to a valid dta file. Additionally, certain values are reserved tp represent |
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.
to represent
minor edits, otherwise looks good. |
@@ -3504,6 +3504,28 @@ into a .dta file. The format version of this file is always 115 (Stata 12). | |||
df = DataFrame(randn(10, 2), columns=list('AB')) | |||
df.to_stata('stata.dta') | |||
|
|||
*Stata* data files have limited data type support; only strings with 244 or | |||
fewer characters, ``int8``, ``int16``, ``int32`` and ``float64`` can written |
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 be written. maybe say .dta
file
Added support for uint (uint8, uint16 and uint32, but not uint64) and bool datatypes in to_stata. Added an explanation of supported data types in io.rst. closes pandas-dev#7097 and closes pandas-dev#7365
thanks @bashtage continued awesome stata support is great! |
merged via 7745d72 |
Added support for uint (uint8, uint16 and uint32, but not uint64) and bool
datatypes in to_stata.
closes #7097
closes #7365