Skip to content

Commit 8ff2ebd

Browse files
ShaharNavehWillAyd
authored andcommitted
STY: concat strings (#30991)
1 parent 2075539 commit 8ff2ebd

File tree

20 files changed

+47
-87
lines changed

20 files changed

+47
-87
lines changed

pandas/compat/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,7 @@ def _import_lzma():
110110
return lzma
111111
except ImportError:
112112
msg = (
113-
"Could not import the lzma module. "
114-
"Your installed Python is incomplete. "
113+
"Could not import the lzma module. Your installed Python is incomplete. "
115114
"Attempting to use lzma compression will result in a RuntimeError."
116115
)
117116
warnings.warn(msg)

pandas/compat/numpy/__init__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,9 @@
1818

1919
if _nlv < "1.13.3":
2020
raise ImportError(
21-
f"this version of pandas is incompatible with "
22-
f"numpy < 1.13.3\n"
21+
"this version of pandas is incompatible with numpy < 1.13.3\n"
2322
f"your numpy version is {_np_version}.\n"
24-
f"Please upgrade numpy to >= 1.13.3 to use "
25-
f"this pandas version"
23+
"Please upgrade numpy to >= 1.13.3 to use this pandas version"
2624
)
2725

2826

pandas/compat/numpy/function.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -389,9 +389,8 @@ def validate_resampler_func(method: str, args, kwargs) -> None:
389389
if len(args) + len(kwargs) > 0:
390390
if method in RESAMPLER_NUMPY_OPS:
391391
raise UnsupportedFunctionCall(
392-
f"numpy operations are not "
393-
f"valid with resample. Use "
394-
f".resample(...).{method}() instead"
392+
"numpy operations are not valid with resample. "
393+
f"Use .resample(...).{method}() instead"
395394
)
396395
else:
397396
raise TypeError("too many arguments passed in")

pandas/core/generic.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1701,8 +1701,7 @@ def _get_label_or_level_values(self, key: str, axis: int = 0) -> np.ndarray:
17011701
multi_message = (
17021702
"\n"
17031703
"For a multi-index, the label must be a "
1704-
"tuple with elements corresponding to "
1705-
"each level."
1704+
"tuple with elements corresponding to each level."
17061705
)
17071706
else:
17081707
multi_message = ""

pandas/core/reshape/concat.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,7 @@ def __init__(
305305
if isinstance(objs, (NDFrame, str)):
306306
raise TypeError(
307307
"first argument must be an iterable of pandas "
308-
"objects, you passed an object of type "
309-
'"{name}"'.format(name=type(objs).__name__)
308+
f'objects, you passed an object of type "{type(objs).__name__}"'
310309
)
311310

312311
if join == "outer":
@@ -577,10 +576,7 @@ def _maybe_check_integrity(self, concat_index: Index):
577576
if self.verify_integrity:
578577
if not concat_index.is_unique:
579578
overlap = concat_index[concat_index.duplicated()].unique()
580-
raise ValueError(
581-
"Indexes have overlapping values: "
582-
"{overlap!s}".format(overlap=overlap)
583-
)
579+
raise ValueError(f"Indexes have overlapping values: {overlap}")
584580

585581

586582
def _concat_indexes(indexes) -> Index:
@@ -648,8 +644,7 @@ def _make_concat_multiindex(indexes, keys, levels=None, names=None) -> MultiInde
648644
# make sure that all of the passed indices have the same nlevels
649645
if not len({idx.nlevels for idx in indexes}) == 1:
650646
raise AssertionError(
651-
"Cannot concat indices that do "
652-
"not have the same number of levels"
647+
"Cannot concat indices that do not have the same number of levels"
653648
)
654649

655650
# also copies

pandas/core/reshape/merge.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,9 +1071,8 @@ def _maybe_coerce_merge_keys(self):
10711071
continue
10721072

10731073
msg = (
1074-
"You are trying to merge on {lk_dtype} and "
1075-
"{rk_dtype} columns. If you wish to proceed "
1076-
"you should use pd.concat".format(lk_dtype=lk.dtype, rk_dtype=rk.dtype)
1074+
f"You are trying to merge on {lk.dtype} and "
1075+
f"{rk.dtype} columns. If you wish to proceed you should use pd.concat"
10771076
)
10781077

10791078
# if we are numeric, then allow differing

pandas/io/clipboards.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ def read_clipboard(sep=r"\s+", **kwargs): # pragma: no cover
6969
kwargs["engine"] = "python"
7070
elif len(sep) > 1 and kwargs.get("engine") == "c":
7171
warnings.warn(
72-
"read_clipboard with regex separator does not work "
73-
"properly with c engine"
72+
"read_clipboard with regex separator does not work properly with c engine"
7473
)
7574

7675
return read_csv(StringIO(text), sep=sep, **kwargs)

pandas/io/common.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@ def _expand_user(
7878
def validate_header_arg(header) -> None:
7979
if isinstance(header, bool):
8080
raise TypeError(
81-
"Passing a bool to header is invalid. "
82-
"Use header=None for no header or "
81+
"Passing a bool to header is invalid. Use header=None for no header or "
8382
"header=int or list-like of ints to specify "
8483
"the row(s) making up the column names"
8584
)

pandas/io/date_converters.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ def _check_columns(cols):
5757
for i, n in enumerate(map(len, tail)):
5858
if n != N:
5959
raise AssertionError(
60-
f"All columns must have the same length: {N}; "
61-
f"column {i} has length {n}"
60+
f"All columns must have the same length: {N}; column {i} has length {n}"
6261
)
6362

6463
return N

pandas/io/feather_format.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,13 @@ def to_feather(df: DataFrame, path):
3737
typ = type(df.index)
3838
raise ValueError(
3939
f"feather does not support serializing {typ} "
40-
"for the index; you can .reset_index() "
41-
"to make the index into column(s)"
40+
"for the index; you can .reset_index() to make the index into column(s)"
4241
)
4342

4443
if not df.index.equals(RangeIndex.from_range(range(len(df)))):
4544
raise ValueError(
46-
"feather does not support serializing a "
47-
"non-default index for the index; you "
48-
"can .reset_index() to make the index "
49-
"into column(s)"
45+
"feather does not support serializing a non-default index for the index; "
46+
"you can .reset_index() to make the index into column(s)"
5047
)
5148

5249
if df.index.name is not None:

0 commit comments

Comments
 (0)