-
- Notifications
You must be signed in to change notification settings - Fork 19.3k
ENH: Explicit range checking when writing Stata #14637
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
pandas/io/stata.py Outdated
| DOUBLE_MAX = struct.unpack('<d', b'\x00\x00\x00\x00\x00\x00\xe0\x7f')[0] | ||
| for col in data: | ||
| if data[col].dtype == np.double: | ||
| value = data[col].max() |
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.
use pandas.types.common.is_floating_dtype (or float_dtype) forgot
| @jreback That doesn't work since it is |
b6f6432 to db89413 Compare | Changed the approach and also added check for |
90d65fe to af41353 Compare Current coverage is 85.28% (diff: 100%)@@ master #14637 diff @@ ========================================== Files 140 140 Lines 50693 50706 +13 Methods 0 0 Messages 0 0 Branches 0 0 ========================================== + Hits 43235 43247 +12 - Misses 7458 7459 +1 Partials 0 0
|
doc/source/whatsnew/v0.20.0.txt Outdated
| Bug Fixes | ||
| ~~~~~~~~~ | ||
| | ||
| - Explicit check in ``to_stata`` and ````StataWriter `` for out-of-range values when writing doubles (:issue:`14618`) |
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.
move to 0.19.2; too many quotes on StataWriter
| | ||
| def test_out_of_range_double(self): | ||
| # GH 14618 | ||
| df = DataFrame({'ColumnOk': [0.0, |
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 u throw some infs (and -infs) in here as well (unless that screws up the test)
| Need to check behavior of infs/-inf, as well as NaN in Stata. It might support these values. |
af41353 to f057d03 Compare | | ||
| Bug Fixes | ||
| ~~~~~~~~~ | ||
| |
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.
you can move to 0.19.2
Add explicit error checking for out-of-range doubles when writing Stata files Upcasts float32 to float64 if out-of-range values encountered Tests for infinite values and raises if found closes pandas-dev#14618
f057d03 to 55a98f5 Compare | so infs are not allowed in state at all? |
|
|
| ok, that's fine then. |
| thanks! |
Add explicit error checking for out-of-range doubles when writing Stata files Upcasts float32 to float64 if out-of-range values encountered Tests for infinite values and raises if found closes pandas-dev#14618 closes pandas-dev#14637 (cherry picked from commit fe555db)
git diff upstream/master | flake8 --diffAdd explicit error checking for out-of-range doubles when writing Stata files
closes #14618