Skip to content

Commit fc952e0

Browse files
Merge remote-tracking branch 'upstream/main' into string-dtype-naming
2 parents 899e3fc + c8bdce9 commit fc952e0

31 files changed

+98
-52
lines changed

ci/code_checks.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
223223
-i "pandas.Timestamp.fromordinal SA01" \
224224
-i "pandas.Timestamp.fromtimestamp PR01,SA01" \
225225
-i "pandas.Timestamp.hour GL08" \
226-
-i "pandas.Timestamp.isoweekday SA01" \
227226
-i "pandas.Timestamp.max PR02" \
228227
-i "pandas.Timestamp.microsecond GL08" \
229228
-i "pandas.Timestamp.min PR02" \
@@ -328,7 +327,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
328327
-i "pandas.core.groupby.DataFrameGroupBy.hist RT03" \
329328
-i "pandas.core.groupby.DataFrameGroupBy.indices SA01" \
330329
-i "pandas.core.groupby.DataFrameGroupBy.max SA01" \
331-
-i "pandas.core.groupby.DataFrameGroupBy.median SA01" \
332330
-i "pandas.core.groupby.DataFrameGroupBy.min SA01" \
333331
-i "pandas.core.groupby.DataFrameGroupBy.nth PR02" \
334332
-i "pandas.core.groupby.DataFrameGroupBy.nunique SA01" \
@@ -347,7 +345,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
347345
-i "pandas.core.groupby.SeriesGroupBy.is_monotonic_decreasing SA01" \
348346
-i "pandas.core.groupby.SeriesGroupBy.is_monotonic_increasing SA01" \
349347
-i "pandas.core.groupby.SeriesGroupBy.max SA01" \
350-
-i "pandas.core.groupby.SeriesGroupBy.median SA01" \
351348
-i "pandas.core.groupby.SeriesGroupBy.min SA01" \
352349
-i "pandas.core.groupby.SeriesGroupBy.nth PR02" \
353350
-i "pandas.core.groupby.SeriesGroupBy.ohlc SA01" \
@@ -362,7 +359,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
362359
-i "pandas.core.resample.Resampler.indices SA01" \
363360
-i "pandas.core.resample.Resampler.max PR01,RT03,SA01" \
364361
-i "pandas.core.resample.Resampler.mean SA01" \
365-
-i "pandas.core.resample.Resampler.median SA01" \
366362
-i "pandas.core.resample.Resampler.min PR01,RT03,SA01" \
367363
-i "pandas.core.resample.Resampler.ohlc SA01" \
368364
-i "pandas.core.resample.Resampler.prod SA01" \

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/_libs/tslibs/nattype.pyx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,13 @@ class NaTType(_NaT):
441441
442442
Monday == 1 ... Sunday == 7.
443443
444+
See Also
445+
--------
446+
Timestamp.weekday : Return the day of the week with Monday=0, Sunday=6.
447+
Timestamp.isocalendar : Return a tuple containing ISO year, week number
448+
and weekday.
449+
datetime.date.isoweekday : Equivalent method in datetime module.
450+
444451
Examples
445452
--------
446453
>>> ts = pd.Timestamp('2023-01-01 10:00:00')

pandas/_libs/tslibs/timestamps.pyx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2775,6 +2775,13 @@ default 'raise'
27752775
27762776
Monday == 1 ... Sunday == 7.
27772777
2778+
See Also
2779+
--------
2780+
Timestamp.weekday : Return the day of the week with Monday=0, Sunday=6.
2781+
Timestamp.isocalendar : Return a tuple containing ISO year, week number
2782+
and weekday.
2783+
datetime.date.isoweekday : Equivalent method in datetime module.
2784+
27782785
Examples
27792786
--------
27802787
>>> ts = pd.Timestamp('2023-01-01 10:00:00')

pandas/core/groupby/groupby.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2347,6 +2347,12 @@ def median(self, numeric_only: bool = False) -> NDFrameT:
23472347
Series or DataFrame
23482348
Median of values within each group.
23492349
2350+
See Also
2351+
--------
2352+
Series.groupby : Apply a function groupby to a Series.
2353+
DataFrame.groupby : Apply a function groupby to each row or column of a
2354+
DataFrame.
2355+
23502356
Examples
23512357
--------
23522358
For SeriesGroupBy:

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/arithmetic/test_datetime64.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,22 @@ def test_dt64_compare_datetime_scalar(self, datetimelike, op, expected):
389389
expected = Series(expected, name="A")
390390
tm.assert_series_equal(result, expected)
391391

392+
def test_ts_series_numpy_maximum(self):
393+
# GH#50864, test numpy.maximum does not fail
394+
# given a TimeStamp and Series(with dtype datetime64) comparison
395+
ts = Timestamp("2024-07-01")
396+
ts_series = Series(
397+
["2024-06-01", "2024-07-01", "2024-08-01"],
398+
dtype="datetime64[us]",
399+
)
400+
401+
expected = Series(
402+
["2024-07-01", "2024-07-01", "2024-08-01"],
403+
dtype="datetime64[us]",
404+
)
405+
406+
tm.assert_series_equal(expected, np.maximum(ts, ts_series))
407+
392408

393409
class TestDatetimeIndexComparisons:
394410
# TODO: moved from tests.indexes.test_base; parametrize and de-duplicate

pandas/tests/arithmetic/test_object.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
import numpy as np
99
import pytest
1010

11-
from pandas._config import using_string_dtype
12-
1311
import pandas.util._test_decorators as td
1412

1513
import pandas as pd
@@ -303,7 +301,6 @@ def test_iadd_string(self):
303301
index += "_x"
304302
assert "a_x" in index
305303

306-
@pytest.mark.xfail(using_string_dtype(), reason="add doesn't work")
307304
def test_add(self):
308305
index = pd.Index([str(i) for i in range(10)])
309306
expected = pd.Index(index.values * 2)

pandas/tests/base/test_unique.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import numpy as np
22
import pytest
33

4-
from pandas._config import using_string_dtype
5-
64
import pandas as pd
75
import pandas._testing as tm
86
from pandas.tests.base.common import allow_na_ops
@@ -100,12 +98,11 @@ def test_nunique_null(null_obj, index_or_series_obj):
10098

10199

102100
@pytest.mark.single_cpu
103-
@pytest.mark.xfail(using_string_dtype(), reason="decoding fails")
104101
def test_unique_bad_unicode(index_or_series):
105102
# regression test for #34550
106103
uval = "\ud83d" # smiley emoji
107104

108-
obj = index_or_series([uval] * 2)
105+
obj = index_or_series([uval] * 2, dtype=object)
109106
result = obj.unique()
110107

111108
if isinstance(obj, pd.Index):

pandas/tests/frame/constructors/test_from_dict.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def test_constructor_single_row(self):
4444
)
4545
tm.assert_frame_equal(result, expected)
4646

47-
@pytest.mark.skipif(using_string_dtype(), reason="columns inferring logic broken")
47+
@pytest.mark.xfail(using_string_dtype(), reason="columns inferring logic broken")
4848
def test_constructor_list_of_series(self):
4949
data = [
5050
OrderedDict([["a", 1.5], ["b", 3.0], ["c", 4.0]]),
@@ -108,6 +108,7 @@ def test_constructor_list_of_series(self):
108108
expected = DataFrame.from_dict(sdict, orient="index")
109109
tm.assert_frame_equal(result, expected)
110110

111+
@pytest.mark.xfail(using_string_dtype(), reason="columns inferring logic broken")
111112
def test_constructor_orient(self, float_string_frame):
112113
data_dict = float_string_frame.T._series
113114
recons = DataFrame.from_dict(data_dict, orient="index")

0 commit comments

Comments
 (0)