Skip to content

Commit a775f9f

Browse files
Merge remote-tracking branch 'upstream/main' into fix-ci
2 parents 0e87c2c + 4bbb3ce commit a775f9f

File tree

4 files changed

+23
-16
lines changed

4 files changed

+23
-16
lines changed

.github/workflows/unit-tests.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ jobs:
8686
TEST_ARGS: ${{ matrix.test_args || '' }}
8787
PYTEST_WORKERS: 'auto'
8888
PYTEST_TARGET: ${{ matrix.pytest_target || 'pandas' }}
89-
NPY_PROMOTION_STATE: ${{ matrix.env_file == 'actions-311-numpydev.yaml' && 'weak' || 'legacy' }}
9089
# Clipboard tests
9190
QT_QPA_PLATFORM: offscreen
9291
REMOVE_PYARROW: ${{ matrix.name == 'Future infer strings (without pyarrow)' && '1' || '0' }}

ci/deps/actions-311-pyarrownightly.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ dependencies:
1818

1919
# required dependencies
2020
- python-dateutil
21-
- numpy<2
21+
- numpy
2222
- pip
2323

2424
- pip:

pandas/tests/dtypes/test_dtypes.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,3 +1243,12 @@ def test_loc_setitem_empty_labels_no_dtype_conversion():
12431243

12441244
assert df.a.dtype == "int64"
12451245
tm.assert_frame_equal(df, expected)
1246+
1247+
1248+
def test_categorical_nan_no_dtype_conversion():
1249+
# GH 43996
1250+
1251+
df = pd.DataFrame({"a": Categorical([np.nan], [1]), "b": [1]})
1252+
expected = pd.DataFrame({"a": Categorical([1], [1]), "b": [1]})
1253+
df.loc[0, "a"] = np.array([1])
1254+
tm.assert_frame_equal(df, expected)

pandas/tests/io/test_parquet.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
pa_version_under13p0,
1818
pa_version_under15p0,
1919
pa_version_under17p0,
20-
pa_version_under18p0,
2120
)
2221

2322
import pandas as pd
@@ -974,21 +973,9 @@ def test_timestamp_nanoseconds(self, pa):
974973
df = pd.DataFrame({"a": pd.date_range("2017-01-01", freq="1ns", periods=10)})
975974
check_round_trip(df, pa, write_kwargs={"version": ver})
976975

977-
def test_timezone_aware_index(self, request, pa, timezone_aware_date_list):
976+
def test_timezone_aware_index(self, pa, timezone_aware_date_list):
978977
pytest.importorskip("pyarrow", "11.0.0")
979978

980-
if (
981-
timezone_aware_date_list.tzinfo != datetime.timezone.utc
982-
and pa_version_under18p0
983-
):
984-
request.applymarker(
985-
pytest.mark.xfail(
986-
reason=(
987-
"pyarrow returns pytz.FixedOffset while pandas "
988-
"constructs datetime.timezone https://github.com/pandas-dev/pandas/issues/37286"
989-
)
990-
)
991-
)
992979
idx = 5 * [timezone_aware_date_list]
993980
df = pd.DataFrame(index=idx, data={"index_as_col": idx})
994981

@@ -1005,6 +992,18 @@ def test_timezone_aware_index(self, request, pa, timezone_aware_date_list):
1005992
expected = df[:]
1006993
if pa_version_under11p0:
1007994
expected.index = expected.index.as_unit("ns")
995+
if timezone_aware_date_list.tzinfo != datetime.timezone.utc:
996+
# pyarrow returns pytz.FixedOffset while pandas constructs datetime.timezone
997+
# https://github.com/pandas-dev/pandas/issues/37286
998+
try:
999+
import pytz
1000+
except ImportError:
1001+
pass
1002+
else:
1003+
offset = df.index.tz.utcoffset(timezone_aware_date_list)
1004+
tz = pytz.FixedOffset(offset.total_seconds() / 60)
1005+
expected.index = expected.index.tz_convert(tz)
1006+
expected["index_as_col"] = expected["index_as_col"].dt.tz_convert(tz)
10081007
check_round_trip(df, pa, check_dtype=False, expected=expected)
10091008

10101009
def test_filter_row_groups(self, pa):

0 commit comments

Comments
 (0)