Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changed "fun !r" -> "repr(fun)" #1

Merged
merged 1 commit into from
Dec 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -2944,7 +2944,7 @@ def _try_kind_sort(arr):
sortedIdx[n:] = idx[good][argsorted]
sortedIdx[:n] = idx[bad]
else:
raise ValueError("invalid na_position: {!r}".format(na_position))
raise ValueError(f"invalid na_position: {repr(na_position)}")

result = self._constructor(arr[sortedIdx], index=self.index[sortedIdx])

Expand Down
4 changes: 2 additions & 2 deletions pandas/core/sorting.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def lexsort_indexer(keys, orders=None, na_position="last"):
cat = Categorical(key, ordered=True)

if na_position not in ["last", "first"]:
raise ValueError("invalid na_position: {!r}".format(na_position))
raise ValueError(f"invalid na_position: {repr(na_position)}")

n = len(cat.categories)
codes = cat.codes.copy()
Expand Down Expand Up @@ -264,7 +264,7 @@ def nargsort(items, kind="quicksort", ascending: bool = True, na_position="last"
elif na_position == "first":
indexer = np.concatenate([nan_idx, indexer])
else:
raise ValueError("invalid na_position: {!r}".format(na_position))
raise ValueError(f"invalid na_position: {repr(na_position)}")
return indexer


Expand Down
6 changes: 2 additions & 4 deletions pandas/core/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -1933,10 +1933,8 @@ def _forbid_nonstring_types(func):
def wrapper(self, *args, **kwargs):
if self._inferred_dtype not in allowed_types:
msg = (
"Cannot use .str.{name} with values of inferred dtype "
"{inf_type!r}.".format(
name=func_name, inf_type=self._inferred_dtype
)
f"Cannot use .str.{func_name} with values of inferred dtype "
f"{repr(self._inferred_dtype)}."
)
raise TypeError(msg)
return func(self, *args, **kwargs)
Expand Down