79761322

Date: 2025-09-10 21:55:49
Score: 1
Natty:
Report link

So, for a panda dataframe object, when using the .to_string method, there is a parameter you can specify now for column spacing! I do not know if this is just in newer versions and was not around when you had this problem 4 years ago, but:

print (#dataframeobjectname#.to_string(col_space=#n#)) Will insert spaces between the columns for you. With values of n of 1 or below, the spacing between columns is 1 space, but as you increase n, the number of spaces you specify does get inserted between columns. Interesting effect, though, it adds n-1 spaces in front of the first column, LOL.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Kenneth Widel