Skip to content
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
4 changes: 2 additions & 2 deletions pandas/core/arrays/period.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,11 +298,11 @@ def __arrow_array__(self, type=None):
if self.freqstr != type.freq:
raise TypeError(
"Not supported to convert PeriodArray to array with different"
" 'freq' ({0} vs {1})".format(self.freqstr, type.freq)
f" 'freq' ({self.freqstr} vs {type.freq})"
)
else:
raise TypeError(
"Not supported to convert PeriodArray to '{0}' type".format(type)
f"Not supported to convert PeriodArray to '{type}' type"
)

period_type = ArrowPeriodType(self.freqstr)
Expand Down
3 changes: 1 addition & 2 deletions pandas/core/dtypes/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,11 @@ def ensure_python_int(value: Union[int, np.integer]) -> int:
"""
if not is_scalar(value):
raise TypeError(f"Value needs to be a scalar value, was type {type(value)}")
msg = "Wrong type {} for value {}"
try:
new_value = int(value)
assert new_value == value
except (TypeError, ValueError, AssertionError):
raise TypeError(msg.format(type(value), value))
raise TypeError(f"Wrong type {type(value)} for value {value}")
return new_value


Expand Down
3 changes: 1 addition & 2 deletions pandas/core/dtypes/dtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,12 +435,11 @@ def __eq__(self, other: Any) -> bool:
return hash(self) == hash(other)

def __repr__(self) -> str_type:
tpl = "CategoricalDtype(categories={data}ordered={ordered})"
if self.categories is None:
data = "None, "
else:
data = self.categories._format_data(name=type(self).__name__)
return tpl.format(data=data, ordered=self.ordered)
return f"CategoricalDtype(categories={data}ordered={self.ordered})"

@staticmethod
def _hash_categories(categories, ordered: Ordered = True) -> int:
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -2431,7 +2431,7 @@ def _verbose_repr():
dtype = self.dtypes.iloc[i]
col = pprint_thing(col)

line_no = _put_str(" {num}".format(num=i), space_num)
line_no = _put_str(f" {i}", space_num)
count = ""
if show_counts:
count = counts.iloc[i]
Expand Down