title: Pandas dataframe to html, unable to display to 2 decimal places
body: <p>No matter how I try and round and display this data to 2 decimal places (d.p), I can’t seem to get it to work. Basically the DR, CR and Balance columns refer to financials, so a 2 d.p. display is required. But the CR column is only showing to 1 d.p for the zero values. There are also other errors such as the balance in the first row also only showing to 1 d.p.</p>
  
  <p>As you can see, I am importing from sqlite3 and exporting to html and working with a dataframe in-between. Thanks</p>
  
  <pre><code>df = pd.read_sql_query("SELECT * FROM "+n+" ORDER BY Date", conn)
  df["DR"] = pd.to_numeric(df["DR"])
  df["CR"] = pd.to_numeric(df["CR"])
  df = df.fillna(0)
  df["Balance"] = ''
  i = 0
  df.iloc[i,6] = df.iloc[i,3]-df.iloc[i,4]
  for i in range(1,df.shape[0]):
      try:df.iloc[i,6] = df.iloc[i-1,6]+df.iloc[i,3]-df.iloc[i,4]
      except: pass
  for u in range(df.shape[0]):
      try:
          if df.iloc[u,6] &lt;= 0:
              CRt = abs(df.iloc[u,6])
              #df.iloc[u,6] = str(abs(df.iloc[u,6]))+' CR' 
              df.iloc[u,6] = str(CRt.round(decimals=2))+' CR' 
          else:
              DRt = df.iloc[u,6]
              df.iloc[u,6] = str(DRt.round(decimals=2))+' DR' 
      except:
          pass
  df = df.fillna('')
  html = df.to_html(header=True,classes="table table-sm table-hover",justify="center",index=False)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/iYzrk.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iYzrk.jpg" alt="enter image description here"></a></p>