Skip to content

Commit a061863

Browse files
committed
Ready for PR
1 parent 4dd2612 commit a061863

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

pandas/core/arrays/string_arrow.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def _from_sequence(
190190

191191
_chk_pyarrow_available()
192192

193-
# Bug fix handle explicit dtype "string" or "str"
193+
# handle explicit dtype "string" or "str"
194194
if dtype:
195195
if isinstance(dtype, str) and dtype == "str":
196196
# Use StringDtype with Python storage explicitly
@@ -211,7 +211,7 @@ def _from_sequence(
211211
return cls(pc.cast(scalars, pa.large_string()))
212212

213213

214-
elif isinstance(scalars, KeysView): #Bug Fix
214+
elif isinstance(scalars, KeysView):
215215
#Convert dict_keys to a NumPy array. Note dict_keys is a type alias for KeysView.
216216
scalars = list(scalars)
217217

pandas/core/construction.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -666,11 +666,11 @@ def sanitize_array(
666666
subarr = _sanitize_str_dtypes(subarr, data, dtype, copy)
667667

668668
from pandas.core.arrays.string_ import StringDtype
669-
if dtype == "str": #Bug fix
669+
if dtype == "str":
670670
# Use StringDtype explicitly when dtype="str"
671671
dtype = StringDtype(storage="python")
672672

673-
if isinstance(data, KeysView): #Bug fix
673+
if isinstance(data, KeysView):
674674
# Convert dict_keys to a list for processing
675675
data = list(data)
676676

pandas/core/indexes/base.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -483,16 +483,15 @@ def __new__(
483483
tupleize_cols: bool = True,
484484
) -> Self:
485485
from pandas.core.indexes.range import RangeIndex
486-
from pandas.core.arrays.string_ import StringDtype #Bug fix
486+
from pandas.core.arrays.string_ import StringDtype
487487

488488
name = maybe_extract_name(name, data, cls)
489489

490490
if dtype is not None:
491-
if dtype == "str": #Bug fix
491+
if dtype == "str":
492492
dtype = StringDtype(storage="python")
493493
dtype = pandas_dtype(dtype)
494494

495-
496495
data_dtype = getattr(data, "dtype", None)
497496

498497
refs = None
@@ -570,7 +569,7 @@ def __new__(
570569

571570
try:
572571
arr = sanitize_array(data, None, dtype=dtype, copy=copy)
573-
#print(f"sanitize_array received dtype: {dtype}")
572+
#print(f"sanitize_array received dtype: {dtype}")
574573
except ValueError as err:
575574
if "index must be specified when data is not list-like" in str(err):
576575
raise cls._raise_scalar_data_error(data) from err

pandas/tests/indexes/test_base.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ def test_constructor_casting(self, index):
6969
arr = np.array(index)
7070
new_index = Index(arr)
7171
tm.assert_contains_all(arr, new_index)
72-
#tm.assert_index_equal(index, new_index)
7372

7473
if index.dtype.name == "string":
7574
# Allow conversion to object when casting back through NumPy array
@@ -1744,7 +1743,7 @@ def test_is_monotonic_pyarrow_list_type():
17441743
assert not idx.is_monotonic_increasing
17451744
assert not idx.is_monotonic_decreasing
17461745

1747-
def test_index_from_dict_keys_with_dtype(): # Bug fix
1746+
def test_index_from_dict_keys_with_dtype():
17481747
d = {"a": 1, "b": 2}
17491748

17501749
# Test without dtype (default inference)

0 commit comments

Comments
 (0)