Skip to content

Commit 21c1d28

Browse files
committed
Add xfail mark to tests and merge new changes from main
2 parents 3e38fb5 + 5af55e0 commit 21c1d28

File tree

12 files changed

+41
-20
lines changed

12 files changed

+41
-20
lines changed

doc/source/whatsnew/v3.0.0.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,7 @@ I/O
584584
- Bug in :meth:`read_json` not validating the ``typ`` argument to not be exactly ``"frame"`` or ``"series"`` (:issue:`59124`)
585585
- Bug in :meth:`read_stata` raising ``KeyError`` when input file is stored in big-endian format and contains strL data. (:issue:`58638`)
586586
- Bug in :meth:`read_stata` where extreme value integers were incorrectly interpreted as missing for format versions 111 and prior (:issue:`58130`)
587+
- Bug in :meth:`read_stata` where the missing code for double was not recognised for format versions 105 and prior (:issue:`58149`)
587588

588589
Period
589590
^^^^^^

pandas/io/stata.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1817,10 +1817,19 @@ def read(
18171817
return data
18181818

18191819
def _do_convert_missing(self, data: DataFrame, convert_missing: bool) -> DataFrame:
1820+
# missing code for double was different in version 105 and prior
1821+
old_missingdouble = float.fromhex("0x1.0p333")
1822+
18201823
# Check for missing values, and replace if found
18211824
replacements = {}
18221825
for i in range(len(data.columns)):
18231826
fmt = self._typlist[i]
1827+
# recode instances of the old missing code to the currently used value
1828+
if self._format_version <= 105 and fmt == "d":
1829+
data.iloc[:, i] = data.iloc[:, i].replace(
1830+
old_missingdouble, self.MISSING_VALUES["d"]
1831+
)
1832+
18241833
if self._format_version <= 111:
18251834
if fmt not in self.OLD_VALID_RANGE:
18261835
continue

pandas/tests/arrays/numpy_/test_numpy.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,10 @@ def test_validate_reduction_keyword_args():
197197
arr.all(keepdims=True)
198198

199199

200+
@pytest.mark.xfail
200201
@pytest.mark.parametrize(
201202
"value, expectedError",
202203
[
203-
(True, False),
204-
(9, False),
205204
(5.5, True),
206205
(1 + 2j, True),
207206
("t", True),
@@ -218,12 +217,10 @@ def test_int_arr_validate_setitem_value(value, expectedError):
218217
assert arr[0] == value
219218

220219

220+
@pytest.mark.xfail
221221
@pytest.mark.parametrize(
222222
"value, expectedError",
223223
[
224-
(True, False),
225-
(9, False),
226-
(5.5, False),
227224
(1 + 2j, True),
228225
("t", True),
229226
(datetime.now(), True),
@@ -239,13 +236,10 @@ def test_float_arr_validate_setitem_value(value, expectedError):
239236
assert arr[0] == value
240237

241238

239+
@pytest.mark.xfail
242240
@pytest.mark.parametrize(
243241
"value, expectedError",
244242
[
245-
(True, False),
246-
(9, False),
247-
(5.5, False),
248-
("t", False),
249243
(datetime.now(), True),
250244
],
251245
)
362 Bytes
Binary file not shown.
364 Bytes
Binary file not shown.
363 Bytes
Binary file not shown.
409 Bytes
Binary file not shown.
362 Bytes
Binary file not shown.
364 Bytes
Binary file not shown.
363 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)