Skip to content

Commit 7b9b937

Browse files
committed
Merge remote-tracking branch 'upstream/main' into feature-plot-weighted-kde
2 parents 092e216 + ebc60f2 commit 7b9b937

36 files changed

+148
-25
lines changed

.github/workflows/unit-tests.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ jobs:
5757
# Also install zh_CN (its encoding is gb2312) but do not activate it.
5858
# It will be temporarily activated during tests with locale.setlocale
5959
extra_loc: "zh_CN"
60+
- name: "Future infer strings"
61+
env_file: actions-311.yaml
62+
pattern: "not slow and not network and not single_cpu"
63+
pandas_future_infer_string: "1"
6064
- name: "Pypy"
6165
env_file: actions-pypy-39.yaml
6266
pattern: "not slow and not network and not single_cpu"
@@ -75,6 +79,7 @@ jobs:
7579
LANG: ${{ matrix.lang || 'C.UTF-8' }}
7680
LC_ALL: ${{ matrix.lc_all || '' }}
7781
PANDAS_CI: '1'
82+
PANDAS_FUTURE_INFER_STRING: ${{ matrix.pandas_future_infer_string || '0' }}
7883
TEST_ARGS: ${{ matrix.test_args || '' }}
7984
PYTEST_WORKERS: 'auto'
8085
PYTEST_TARGET: ${{ matrix.pytest_target || 'pandas' }}

ci/code_checks.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
304304
-i "pandas.api.types.is_re PR07,SA01" \
305305
-i "pandas.api.types.is_re_compilable PR07,SA01" \
306306
-i "pandas.api.types.is_sparse SA01" \
307-
-i "pandas.api.types.is_string_dtype SA01" \
308307
-i "pandas.api.types.is_timedelta64_ns_dtype SA01" \
309308
-i "pandas.api.types.pandas_dtype PR07,RT03,SA01" \
310309
-i "pandas.api.types.union_categoricals RT03,SA01" \

ci/run_tests.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,11 @@ if [[ "$PATTERN" ]]; then
1616
PYTEST_CMD="$PYTEST_CMD -m \"$PATTERN\""
1717
fi
1818

19+
# temporarily let pytest always succeed (many tests are not yet passing in the
20+
# build enabling the future string dtype)
21+
if [[ "$PANDAS_FUTURE_INFER_STRING" == "1" ]]; then
22+
PYTEST_CMD="$PYTEST_CMD || true"
23+
fi
24+
1925
echo $PYTEST_CMD
2026
sh -c "$PYTEST_CMD"

doc/source/getting_started/comparison/comparison_with_sql.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ DELETE
505505
DELETE FROM tips
506506
WHERE tip > 9;
507507
508-
In pandas we select the rows that should remain instead of deleting them:
508+
In pandas we select the rows that should remain instead of deleting the rows that should be removed:
509509

510510
.. ipython:: python
511511

doc/source/whatsnew/v3.0.0.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,7 @@ I/O
583583
- Bug in :meth:`read_excel` raising ``ValueError`` when passing array of boolean values when ``dtype="boolean"``. (:issue:`58159`)
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`)
586+
- Bug in :meth:`read_stata` where extreme value integers were incorrectly interpreted as missing for format versions 111 and prior (:issue:`58130`)
586587

587588
Period
588589
^^^^^^

pandas/core/apply.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -486,20 +486,14 @@ def compute_dict_like(
486486
cols = df[key]
487487

488488
if cols.ndim == 1:
489-
series_list = [obj._gotitem(key, ndim=1, subset=cols)]
489+
series = obj._gotitem(key, ndim=1, subset=cols)
490+
results.append(getattr(series, op_name)(how, **kwargs))
491+
keys.append(key)
490492
else:
491-
series_list = []
492-
for index in range(cols.shape[1]):
493-
col = cols.iloc[:, index]
494-
493+
for _, col in cols.items():
495494
series = obj._gotitem(key, ndim=1, subset=col)
496-
series_list.append(series)
497-
498-
for series in series_list:
499-
result = getattr(series, op_name)(how, **kwargs)
500-
results.append(result)
501-
keys.append(key)
502-
495+
results.append(getattr(series, op_name)(how, **kwargs))
496+
keys.append(key)
503497
else:
504498
results = [
505499
getattr(obj._gotitem(key, ndim=1), op_name)(how, **kwargs)

pandas/core/config_init.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,7 @@ def register_converter_cb(key: str) -> None:
858858
with cf.config_prefix("future"):
859859
cf.register_option(
860860
"infer_string",
861-
False,
861+
True if os.environ.get("PANDAS_FUTURE_INFER_STRING", "0") == "1" else False,
862862
"Whether to infer sequence of str objects as pyarrow string "
863863
"dtype, which will be the default in pandas 3.0 "
864864
"(at which point this option will be deprecated).",

pandas/core/dtypes/common.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,11 @@ def is_string_dtype(arr_or_dtype) -> bool:
558558
boolean
559559
Whether or not the array or dtype is of the string dtype.
560560
561+
See Also
562+
--------
563+
api.types.is_string_dtype : Check whether the provided array or dtype
564+
is of the string dtype.
565+
561566
Examples
562567
--------
563568
>>> from pandas.api.types import is_string_dtype

pandas/core/frame.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,7 @@ class DataFrame(NDFrame, OpsMixin):
531531
will perform column selection instead.
532532
dtype : dtype, default None
533533
Data type to force. Only a single dtype is allowed. If None, infer.
534+
If ``data`` is DataFrame then is ignored.
534535
copy : bool or None, default None
535536
Copy data from inputs.
536537
For dict data, the default of None behaves like ``copy=True``. For DataFrame

pandas/core/series.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ class Series(base.IndexOpsMixin, NDFrame): # type: ignore[misc]
256256
Data type for the output Series. If not specified, this will be
257257
inferred from `data`.
258258
See the :ref:`user guide <basics.dtypes>` for more usages.
259+
If ``data`` is Series then is ignored.
259260
name : Hashable, default None
260261
The name to give to the Series.
261262
copy : bool, default False

0 commit comments

Comments
 (0)