Skip to content

Commit

Permalink
change more usages
Browse files Browse the repository at this point in the history
  • Loading branch information
mroeschke committed Oct 9, 2023
1 parent 2180112 commit 835fc11
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
4 changes: 1 addition & 3 deletions pandas/tests/frame/methods/test_select_dtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,7 @@ def test_select_dtypes_datetime_with_tz(self):
expected = df3.reindex(columns=[])
tm.assert_frame_equal(result, expected)

@pytest.mark.parametrize(
"dtype", [str, "str", np.bytes_, "S1", "unicode", np.str_, "U1"]
)
@pytest.mark.parametrize("dtype", [str, "str", np.bytes_, "S1", np.str_, "U1"])
@pytest.mark.parametrize("arg", ["include", "exclude"])
def test_select_dtypes_str_raises(self, dtype, arg):
df = DataFrame(
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/frame/methods/test_to_records.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def test_to_records_with_categorical(self):
),
# Pass in a dtype instance.
(
{"column_dtypes": np.dtype("unicode")},
{"column_dtypes": np.dtype(np.str_)},
np.rec.array(
[("0", "1", "0.2", "a"), ("1", "2", "1.5", "bc")],
dtype=[
Expand Down
10 changes: 5 additions & 5 deletions pandas/tests/indexes/base_class/test_setops.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,23 +182,23 @@ def test_symmetric_difference(self):
"intersection",
np.array(
[(1, "A"), (2, "A"), (1, "B"), (2, "B")],
dtype=[("num", int), ("let", "a1")],
dtype=[("num", int), ("let", "S1")],
),
False,
),
(
"intersection",
np.array(
[(1, "A"), (1, "B"), (2, "A"), (2, "B")],
dtype=[("num", int), ("let", "a1")],
dtype=[("num", int), ("let", "S1")],
),
None,
),
(
"union",
np.array(
[(1, "A"), (1, "B"), (1, "C"), (2, "A"), (2, "B"), (2, "C")],
dtype=[("num", int), ("let", "a1")],
dtype=[("num", int), ("let", "S1")],
),
None,
),
Expand All @@ -208,13 +208,13 @@ def test_tuple_union_bug(self, method, expected, sort):
index1 = Index(
np.array(
[(1, "A"), (2, "A"), (1, "B"), (2, "B")],
dtype=[("num", int), ("let", "a1")],
dtype=[("num", int), ("let", "S1")],
)
)
index2 = Index(
np.array(
[(1, "A"), (2, "A"), (1, "B"), (2, "B"), (1, "C"), (2, "C")],
dtype=[("num", int), ("let", "a1")],
dtype=[("num", int), ("let", "S1")],
)
)

Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/io/json/test_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ def test_blocks_compat_GH9037(self):
)

# JSON deserialisation always creates unicode strings
df_mixed.columns = df_mixed.columns.astype("unicode")
df_mixed.columns = df_mixed.columns.astype(np.str_)
data = StringIO(df_mixed.to_json(orient="split"))
df_roundtrip = read_json(data, orient="split")
tm.assert_frame_equal(
Expand Down

0 comments on commit 835fc11

Please sign in to comment.