Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/2.3.x' into auto-backport-of-p…
Browse files Browse the repository at this point in the history
…r-59906-on-2.3.x
  • Loading branch information
jorisvandenbossche committed Oct 3, 2024
2 parents e565fb5 + 6e5ccd8 commit a30e1d2
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 18 deletions.
2 changes: 2 additions & 0 deletions .github/actions/setup-conda/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ runs:
- name: Install ${{ inputs.environment-file }}
uses: mamba-org/setup-micromamba@v1
with:
# Pinning to avoid 2.0 failures
micromamba-version: '1.5.10-0'
environment-file: ${{ inputs.environment-file }}
environment-name: test
condarc-file: ci/.condarc
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/code-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ on:
push:
branches:
- main
- 2.2.x
- 2.3.x
pull_request:
branches:
- main
- 2.2.x
- 2.3.x

env:
ENV_FILE: environment.yml
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docbuild-and-upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ on:
push:
branches:
- main
- 2.2.x
- 2.3.x
tags:
- '*'
pull_request:
branches:
- main
- 2.2.x
- 2.3.x

env:
ENV_FILE: environment.yml
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/package-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ on:
push:
branches:
- main
- 2.2.x
- 2.3.x
pull_request:
branches:
- main
- 2.2.x
- 2.3.x
types: [ labeled, opened, synchronize, reopened ]

permissions:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ on:
push:
branches:
- main
- 2.2.x
- 2.3.x
pull_request:
branches:
- main
- 2.2.x
- 2.3.x
paths-ignore:
- "doc/**"
- "web/**"
Expand Down
17 changes: 9 additions & 8 deletions pandas/_testing/contexts.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,15 @@ def set_timezone(tz: str) -> Generator[None, None, None]:
import time

def setTZ(tz) -> None:
if tz is None:
try:
del os.environ["TZ"]
except KeyError:
pass
else:
os.environ["TZ"] = tz
time.tzset()
if hasattr(time, "tzset"):
if tz is None:
try:
del os.environ["TZ"]
except KeyError:
pass
else:
os.environ["TZ"] = tz
time.tzset()

orig_tz = os.environ.get("TZ")
setTZ(tz)
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/internals/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1218,7 +1218,7 @@ def _replace_coerce(
putmask_inplace(nb.values, mask, value)
return [nb]
if using_cow:
return [self]
return [self.copy(deep=False)]
return [self] if inplace else [self.copy()]
return self.replace(
to_replace=to_replace,
Expand Down
9 changes: 9 additions & 0 deletions pandas/tests/copy_view/test_replace.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,15 @@ def test_replace_list_none(using_copy_on_write):

assert not np.shares_memory(get_array(df, "a"), get_array(df2, "a"))

# replace multiple values that don't actually replace anything with None
# https://github.com/pandas-dev/pandas/issues/59770
df3 = df.replace(["d", "e", "f"], value=None)
tm.assert_frame_equal(df3, df_orig)
if using_copy_on_write:
assert tm.shares_memory(get_array(df, "a"), get_array(df3, "a"))
else:
assert not tm.shares_memory(get_array(df, "a"), get_array(df3, "a"))


def test_replace_list_none_inplace_refs(using_copy_on_write, warn_copy_on_write):
df = DataFrame({"a": ["a", "b", "c"]})
Expand Down
3 changes: 2 additions & 1 deletion pandas/tests/tslibs/test_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from pandas._libs.tslibs.parsing import parse_datetime_string_with_reso
from pandas.compat import (
ISMUSL,
is_platform_arm,
is_platform_windows,
)
import pandas.util._test_decorators as td
Expand All @@ -26,7 +27,7 @@


@pytest.mark.skipif(
is_platform_windows() or ISMUSL,
is_platform_windows() or ISMUSL or is_platform_arm(),
reason="TZ setting incorrect on Windows and MUSL Linux",
)
def test_parsing_tzlocal_deprecated():
Expand Down

0 comments on commit a30e1d2

Please sign in to comment.