jorisvandenbossche commented on a change in pull request #12148:
URL: https://github.com/apache/arrow/pull/12148#discussion_r786872840



##########
File path: python/pyarrow/table.pxi
##########
@@ -1342,10 +1344,11 @@ cdef class Table(_PandasConvertible):
         if preview_cols:
             pieces.append('----')
             for i in range(min(self.num_columns, preview_cols)):
-                pieces.append('{}: {}'.format(
-                    self.field(i).name,
-                    self.column(i).to_string(indent=0, skip_new_lines=True)
-                ))
+                col_string = self.column(i).to_string(
+                    indent=0, skip_new_lines=True)
+                if len(col_string) > cols_char_limit:
+                    col_string = col_string[:(cols_char_limit - 3)] + '...'
+                pieces.append('{}: {}'.format(self.field(i).name, col_string))

Review comment:
       @edponce I fully agree that, ideally, this truncation is "smart" about 
where to cut off and add `...`. 
   But in general it's also the question to what extent this is worth the extra 
complexity (depending on how complex it would be of course). Instead of parsing 
the string, another option could also be to slice the number of elements before 
converting to string (although for nested data types that won't necessarily 
work as desired). 
   
   Now, on the short-term (for 0.7.0), I personally find it more important that 
we at least do _some_ truncation (because currently the repr can be completely 
useful / annoying by flooding your terminal)




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to