User Tools

Site Tools


print_hundredths

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
round_vs._format [2023/02/08 17:56] rajuround_vs._format [2023/02/13 23:07] raju
Line 1: Line 1:
 ===== round vs. format ===== ===== round vs. format =====
-==== simple data ====+==== write simple data ====
 <code> <code>
 $ ipython $ ipython
Line 34: Line 34:
   * To output dollars and pennies, format expression is better than rounding as it always gives the same number of digits after the decimal point.   * To output dollars and pennies, format expression is better than rounding as it always gives the same number of digits after the decimal point.
  
-==== csv data ====+==== Write data into csv files ====
 Create some sample data Create some sample data
 <code> <code>
Line 102: Line 102:
  
 Ref:- https://stackoverflow.com/questions/20003290/output-different-precision-by-column-with-pandas-dataframe-to-csv - shows how to format different columns with different precision. Ref:- https://stackoverflow.com/questions/20003290/output-different-precision-by-column-with-pandas-dataframe-to-csv - shows how to format different columns with different precision.
 +
 +tags | print two digits after decimal, float_format by column
  
print_hundredths.txt · Last modified: 2023/02/14 23:26 by raju