title: Select a Certain Number of Digits After Decimal (Not Rounding) to Pandas DataFrame Starting From 1st Column - Python
body: <p>I simply wanted to select a certain number of digits (5 digits) after the decimal place for data in a pandas data frame starting from column 1 (python index-0) without rounding</p>
  <p>For example, my pandas look like this</p>
  <pre><code>ids       value1     value2       value3       value4
  ex12    0.1345656    0.1345656   0.1345656   0.1345656
  ex13    0.1345656    0.1345656   0.1345656   0.1345656
  ex14    0.1345656    0.1345656   0.1345656   0.1345656
  ex15    0.1345656    0.1345656   0.1345656   0.1345656
  </code></pre>
  <p>I wanted it to be transformed into this new resulting data frame:</p>
  <pre><code> ids       value1     value2       value3       value4
  ex12    0.13456    0.13456   0.13456   0.13456
  ex13    0.13456    0.13456   0.13456  0.13456
  ex14    0.13456    0.13456   0.13456   0.13456
  ex15    0.13456   0.13456   0.13456   0.13456
  </code></pre>
  <p>So the first column (ids) should never be touched by the transformation and the effect should be only happening from the next column onwards.</p>
  <p>Here is my code attempt in Python:</p>
  <pre><code>import pandas as pd
  data = [['ex12', 0.1345656, 0.1345656, 0.1345656 , 0.1345656], 
          ['ex13', 0.1345656, 0.1345656, 0.1345656 , 0.1345656],
          ['ex14', 0.1345656, 0.1345656, 0.1345656 , 0.1345656],
          ['ex15', 0.1345656, 0.1345656, 0.1345656 , 0.1345656]
         ]
  df
  ids   values1    value2    value3    value4
  0  ex12  0.134566  0.134566  0.134566  0.134566
  1  ex13  0.134566  0.134566  0.134566  0.134566
  2  ex14  0.134566  0.134566  0.134566  0.134566
  3  ex15  0.134566  0.134566  0.134566  0.134566
  </code></pre>
  <p>It doesn't work when I converted it to string data type so I can handel them as a string (slice them). however, when I do this, the resulting transformation is on the row-wise and not the column-wise and that operation also doesn't perform the same for the rest of the columns. Is there a way to do this in pandas?</p>
  <pre><code>df.apply(str).apply(lambda x: x[:12])
  ids        0    ex12\n1 
  values1     0    0.13456
  value2      0    0.13456
  value3      0    0.13456
  value4      0    0.13456
  dtype: object
  </code></pre>
  <p>Thank you so much in advance.</p>