Skip to content

Commit 86b813b

Browse files
Backport PR #42942: ERR: clarify PerformanceWarning for fragmented frame (#42958)
Co-authored-by: Matthew Zeitlin <[email protected]>
1 parent cb52dfd commit 86b813b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pandas/core/internals/managers.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1188,8 +1188,8 @@ def insert(self, loc: int, item: Hashable, value: ArrayLike) -> None:
11881188
warnings.warn(
11891189
"DataFrame is highly fragmented. This is usually the result "
11901190
"of calling `frame.insert` many times, which has poor performance. "
1191-
"Consider using pd.concat instead. To get a de-fragmented frame, "
1192-
"use `newframe = frame.copy()`",
1191+
"Consider joining all columns at once using pd.concat(axis=1) "
1192+
"instead. To get a de-fragmented frame, use `newframe = frame.copy()`",
11931193
PerformanceWarning,
11941194
stacklevel=5,
11951195
)

0 commit comments

Comments
 (0)