Skip to content

Commit 278c700

Browse files
committed
Only remove first character if it is a space
1 parent 4dd3a6f commit 278c700

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pandas/formats/format.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,9 @@ def to_string(self):
607607
if not self.index:
608608
# Remove a single space from the beginning of each line
609609
# and remove any trailing spaces
610-
text = text.replace('\n ', '\n')[1:].rstrip()
610+
if len(text) > 0 and text[0] == ' ':
611+
text = text[1:]
612+
text = text.replace('\n ', '\n').rstrip()
611613
self.buf.writelines(text)
612614

613615
if self.should_show_dimensions:

0 commit comments

Comments
 (0)