Skip to content

Commit 8a427fc

Browse files
committed
Added whatsnew and ran pre-commit
1 parent e1c32f0 commit 8a427fc

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

doc/source/whatsnew/v3.0.0.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,6 +1037,7 @@ Conversion
10371037
- Bug in :meth:`DataFrame.astype` not casting ``values`` for Arrow-based dictionary dtype correctly (:issue:`58479`)
10381038
- Bug in :meth:`DataFrame.update` bool dtype being converted to object (:issue:`55509`)
10391039
- Bug in :meth:`Series.astype` might modify read-only array inplace when casting to a string dtype (:issue:`57212`)
1040+
- Bug in :meth:`Series.convert_dtypes` and :meth:`DataFrame.convert_dtypes` raising ``TypeError`` when called on data with complex dtype (:issue:`60129`)
10401041
- Bug in :meth:`Series.convert_dtypes` and :meth:`DataFrame.convert_dtypes` removing timezone information for objects with :class:`ArrowDtype` (:issue:`60237`)
10411042
- Bug in :meth:`Series.reindex` not maintaining ``float32`` type when a ``reindex`` introduces a missing value (:issue:`45857`)
10421043
- Bug in :meth:`to_datetime` and :meth:`to_timedelta` with input ``None`` returning ``None`` instead of ``NaT``, inconsistent with other conversion methods (:issue:`23055`)

pandas/core/dtypes/cast.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -934,8 +934,7 @@ def convert_dtypes(
934934
if (
935935
convert_string or convert_integer or convert_boolean or convert_floating
936936
) and isinstance(input_array, np.ndarray):
937-
938-
if input_array.dtype.kind == 'c':
937+
if input_array.dtype.kind == "c":
939938
return input_array.dtype
940939

941940
if input_array.dtype == object:

pandas/tests/frame/methods/test_convert_dtypes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ def test_convert_dtype_pyarrow_timezone_preserve(self):
231231

232232
def test_convert_dtypes_complex(self):
233233
# GH 60129
234-
df = pd.DataFrame({'a': [1.0+5.0j, 1.5-3.0j]})
234+
df = pd.DataFrame({"a": [1.0 + 5.0j, 1.5 - 3.0j]})
235235
result = df.convert_dtypes()
236236
tm.assert_frame_equal(result, df)
237-
assert result['a'].dtype.kind == 'c'
237+
assert result["a"].dtype.kind == "c"

pandas/tests/series/methods/test_convert_dtypes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ def test_convert_dtype_pyarrow_timezone_preserve(self):
335335

336336
def test_convert_dtypes_complex(self):
337337
# GH 60129
338-
ser = pd.Series([1.5+3.0j, 1.5-3.0j])
338+
ser = pd.Series([1.5 + 3.0j, 1.5 - 3.0j])
339339
result = ser.convert_dtypes()
340340
tm.assert_series_equal(result, ser)
341-
assert result.dtype.kind == 'c'
341+
assert result.dtype.kind == "c"

0 commit comments

Comments
 (0)