Skip to content

Commit 43e97c5

Browse files
committed
moved test case to frame and serier folders
1 parent 3d40bca commit 43e97c5

File tree

4 files changed

+26
-25
lines changed

4 files changed

+26
-25
lines changed

doc/source/whatsnew/v3.0.0.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,8 +670,8 @@ Conversion
670670
- Bug in :meth:`DataFrame.astype` not casting ``values`` for Arrow-based dictionary dtype correctly (:issue:`58479`)
671671
- Bug in :meth:`DataFrame.update` bool dtype being converted to object (:issue:`55509`)
672672
- Bug in :meth:`Series.astype` might modify read-only array inplace when casting to a string dtype (:issue:`57212`)
673-
- Bug in :meth:`Series.reindex` not maintaining ``float32`` type when a ``reindex`` introduces a missing value (:issue:`45857`)
674673
- Bug in :meth:`Series.convert_dtypes` and :meth:`DataFrame.convert_dtypes` removing timezone information for objects with :class:`ArrowDtype` (:issue:`60237`)
674+
- Bug in :meth:`Series.reindex` not maintaining ``float32`` type when a ``reindex`` introduces a missing value (:issue:`45857`)
675675

676676
Strings
677677
^^^^^^^

pandas/tests/extension/test_arrow.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3511,27 +3511,3 @@ def test_map_numeric_na_action():
35113511
result = ser.map(lambda x: 42, na_action="ignore")
35123512
expected = pd.Series([42.0, 42.0, np.nan], dtype="float64")
35133513
tm.assert_series_equal(result, expected)
3514-
3515-
3516-
def test_convert_dtype_pyarrow_timezone_preserve():
3517-
# GH 60237
3518-
pytest.importorskip("pyarrow")
3519-
ser = pd.Series(
3520-
pd.to_datetime(range(5), utc=True, unit="h"),
3521-
dtype="timestamp[ns, tz=UTC][pyarrow]",
3522-
)
3523-
result = ser.convert_dtypes(dtype_backend="pyarrow")
3524-
expected = ser.copy()
3525-
tm.assert_series_equal(result, expected)
3526-
3527-
df = pd.DataFrame(
3528-
{
3529-
"timestamps": pd.Series(
3530-
pd.to_datetime(range(5), utc=True, unit="h"),
3531-
dtype="timestamp[ns, tz=UTC][pyarrow]",
3532-
)
3533-
}
3534-
)
3535-
result = df.convert_dtypes(dtype_backend="pyarrow")
3536-
expected = df.copy()
3537-
tm.assert_frame_equal(result, expected)

pandas/tests/frame/methods/test_convert_dtypes.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,3 +196,17 @@ def test_convert_dtypes_from_arrow(self):
196196
result = df.convert_dtypes()
197197
expected = df.astype({"a": "string[python]"})
198198
tm.assert_frame_equal(result, expected)
199+
200+
def test_convert_dtype_pyarrow_timezone_preserve(self):
201+
# GH 60237
202+
df = pd.DataFrame(
203+
{
204+
"timestamps": pd.Series(
205+
pd.to_datetime(range(5), utc=True, unit="h"),
206+
dtype="timestamp[ns, tz=UTC][pyarrow]",
207+
)
208+
}
209+
)
210+
result = df.convert_dtypes(dtype_backend="pyarrow")
211+
expected = df.copy()
212+
tm.assert_frame_equal(result, expected)

pandas/tests/series/methods/test_convert_dtypes.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,3 +297,14 @@ def test_convert_dtypes_pyarrow_null(self):
297297
result = ser.convert_dtypes(dtype_backend="pyarrow")
298298
expected = pd.Series([None, None], dtype=pd.ArrowDtype(pa.null()))
299299
tm.assert_series_equal(result, expected)
300+
301+
def test_convert_dtype_pyarrow_timezone_preserve(self):
302+
# GH 60237
303+
pytest.importorskip("pyarrow")
304+
ser = pd.Series(
305+
pd.to_datetime(range(5), utc=True, unit="h"),
306+
dtype="timestamp[ns, tz=UTC][pyarrow]",
307+
)
308+
result = ser.convert_dtypes(dtype_backend="pyarrow")
309+
expected = ser.copy()
310+
tm.assert_series_equal(result, expected)

0 commit comments

Comments
 (0)