Comments (4)
This should be Type-Enhancement, of course.
Original comment by [email protected]
on 26 May 2009 at 4:20
from prettytable.
Sorry for the late response to this, Robert. I haven't been checking the
Issues tab
regularly because I assumed (incorrectly, it turns out) that I would get email
notifications about new issues. Your enhancement request is a good one and I
will
add it to my mental list of things to try out for PrettyTable 0.7. Thanks!
Original comment by [email protected]
on 4 Jun 2009 at 2:03
- Added labels: Type-Enhancement
- Removed labels: Type-Defect
from prettytable.
Hi,
I have just committed changes in response to Issue 10, which I think can be
used to address your issue as well. You can now use:
MyTable.float_format = "4.2"
to make sure that all floating point data in a table is printed using "%4.2f"
formatting. It is possible to use this to get an alignment by decimal. If the
largest floating point value in your table has, say, 5 digits in its
non-decimal part, and you want to display floating point values with 2 digits
after the decimal point, you could use a formatting string of 8.2 (the 8 comes
from the maximum of 5 digits before the decimal point, plus 1 for the decimal
point and then plus 2 for the digits after the point) and the result would look
like this:
+--------------+
| Values |
+--------------+
| 2.35 |
| 61.88 |
| 1024.00 |
| 29109.60 |
| 3.14 |
+--------------+
Or you could use a formatting string of 08.2 to get leading 0s:
+--------------+
| Values |
+--------------+
| 00002.35 |
| 00061.88 |
| 01024.00 |
| 29109.60 |
| 00003.14 |
+--------------+
If this sort of approach meets the use case you had in mind (and you can
remember that use case after me taking 3 years to act on this!), please let me
know. Or, if you had something else in mind, let me know that as well.
Original comment by [email protected]
on 24 Mar 2012 at 3:04
from prettytable.
Given lack of negative feedback about this change for over one month, I am now
closing the issue as "Fixed". If the current implementation of aligning on
decimal points turns out to have shortcomings, people should feel free to
submit a new Issue.
Original comment by [email protected]
on 1 May 2012 at 4:58
- Changed state: Fixed
from prettytable.
Related Issues (20)
- how to display "ambiguous" width in chinese character?
- table.min_width is broken when using PLAIN_COLUMNS style HOT 2
- Field alignment error when using "blessings" module HOT 1
- Adding colors to column values messes up the spacing HOT 2
- Setting float_format in **kwargs does not actually affect output - confusing behavior HOT 1
- Permissions are incorrect HOT 1
- Add date formatting for datetime etc instances HOT 3
- In get_string, end is eval before sortby
- HTML output is lacking borders, alignment
- Cannot print unicode characters, for example: degree symbol °
- Pandas DataFrame Table Factory HOT 3
- Upload new version to pypi
- xterm reset escape sequence not filtered HOT 2
- Support large tables in output HOT 1
- Prettytable 0.7.2 does not handle rowspan correctly
- Creating a PrettyTable inside a for. HOT 1
- Project Future and Plans HOT 4
- Export project to Github (or other git hosting project) HOT 2
- Stretching columns when the data are longer than the header
- Options not actually used in formatting rows
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prettytable.