Skip to content

Commit

Permalink
Merge pull request #1 from souravs17031999/sk_change
Browse files Browse the repository at this point in the history
changed "fun !r" -> "repr(fun)"
  • Loading branch information
souravs17031999 authored Dec 4, 2019
2 parents 6b189d7 + 54a8ff8 commit 8cdbebd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
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

0 comments on commit 8cdbebd

Please sign in to comment.