I am using Pandas 2.0.3 in Python 3.8.10 in Ubuntu 22.04. I have some data frames with several columns that span more than the width of my terminal, which is the default that comes with Ubuntu. Sometimes, for some data frames, Pandas fails to "calculate" the proper width of the terminal and prints data frames in a very ugly way, for example:
This is an example of a VERY similar data frame, just one line of difference between the two prints, for which it calculates the proper width and is printed nicely:
If I slightly change the size of the terminal, this gets fixed randomly. But it is annoying, I am looking for a permanent solution. I have tried several times to find this with Google, but don't know how to search for it.
How can I fix this?