4 ms·
I've literally added Pandas to some of my projects just so I could use a DataFrame to print a nicely formatted table instead of writing code like this. Surely
by Mister_Snuggles 2y ago
I've literally added Pandas to some of my projects just so I could use a DataFrame to print a nicely formatted table instead of writing code like this.
Surely there's a library out there to do this job, it seems like such a common use-case. I'm surprised it's not in the standard library to be honest!
- roelschroeven 2y agoThere is a library: I use tabulate ([1]) semi-regularly for this purpose. There are probably more. I agree it would be very nice to have this in the standard library. [1] https://pypi.org/project/tabulate/ https://pypi.org/project/tabulate/, https://github.com/astanin/python-tabulate https://github.com/astanin/python-tabulate
- Mister_Snuggles 2y agoThank you - this looks like exactly what I was hoping for!
- Liquix 2y agoPrettyTable is another option, actively maintained and much lighter than Pandas
- INTPenis 2y agoI recently used the rich library to print tables in terminal. https://github.com/Textualize/rich https://github.com/Textualize/rich