We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4b0e4c8 commit 8bf0428Copy full SHA for 8bf0428
pandas/formats/format.py
@@ -604,7 +604,10 @@ def to_string(self):
604
self._chk_truncate()
605
strcols = self._to_str_columns()
606
text = self.adj.adjoin(1, *strcols)
607
- if not self.index:
+
608
+ first_column_dtype = (None if len(frame.columns) == 0
609
+ else frame.dtypes[frame.columns[0]])
610
+ if not self.index and first_column_dtype.kind != 'O':
611
# Remove a single space from the beginning of each line
612
# and remove any trailing spaces
613
if len(text) > 0 and text[0] == ' ':
0 commit comments