Round Numbers in Dataframe

Hi,

1]. Is there a way to round all columns to sigdigits=3 in a dataframe from a simulation?
2]. Is there a faster way to download a written CSV, sometimes, when I try to download a dataframe with a large population of 200 subjects, the REPL crashes, or it just does not download for hours?

Thanks.

  1. Yes
julia> using DataFrames

julia> df = DataFrame(rand(100, 4), :auto)
100ร—4 DataFrame
 Row โ”‚ x1         x2         x3         x4         
     โ”‚ Float64    Float64    Float64    Float64    
โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
   1 โ”‚ 0.124564   0.864771   0.626393   0.769189
   2 โ”‚ 0.714328   0.333885   0.0595384  0.547035
   3 โ”‚ 0.558559   0.42749    0.401139   0.796654
   4 โ”‚ 0.363461   0.303619   0.701028   0.357633
   5 โ”‚ 0.698648   0.647859   0.729592   0.754802
   6 โ”‚ 0.394524   0.119908   0.458051   0.00806654
   7 โ”‚ 0.439752   0.941422   0.817513   0.240245
   8 โ”‚ 0.0176141  0.966878   0.950149   0.209727
   9 โ”‚ 0.778352   0.979496   0.344519   0.417361
  10 โ”‚ 0.463619   0.715762   0.600934   0.823153
  11 โ”‚ 0.210912   0.654695   0.226227   0.191472
  12 โ”‚ 0.395527   0.167366   0.365117   0.51622
  โ‹ฎ  โ”‚     โ‹ฎ          โ‹ฎ          โ‹ฎ          โ‹ฎ
  90 โ”‚ 0.0435     0.333514   0.471332   0.663195
  91 โ”‚ 0.0903848  0.23207    0.494652   0.818992
  92 โ”‚ 0.659021   0.719138   0.62941    0.985171
  93 โ”‚ 0.854198   0.410157   0.62477    0.48207
  94 โ”‚ 0.833394   0.47006    0.574971   0.759535
  95 โ”‚ 0.356676   0.545397   0.358455   0.339285
  96 โ”‚ 0.556144   0.262727   0.0975181  0.164304
  97 โ”‚ 0.219012   0.0855951  0.252604   0.176979
  98 โ”‚ 0.673927   0.899355   0.417918   0.00584851
  99 โ”‚ 0.555973   0.539306   0.757973   0.806727
 100 โ”‚ 0.926957   0.899353   0.285144   0.935615
                                    77 rows omitted

julia> transform!(df, All() .=> ByRow(x -> round(x; digits=3)); renamecols=false)
100ร—4 DataFrame
 Row โ”‚ x1       x2       x3       x4      
     โ”‚ Float64  Float64  Float64  Float64 
โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
   1 โ”‚   0.125    0.865    0.626    0.769
   2 โ”‚   0.714    0.334    0.06     0.547
   3 โ”‚   0.559    0.427    0.401    0.797
   4 โ”‚   0.363    0.304    0.701    0.358
   5 โ”‚   0.699    0.648    0.73     0.755
   6 โ”‚   0.395    0.12     0.458    0.008
   7 โ”‚   0.44     0.941    0.818    0.24
   8 โ”‚   0.018    0.967    0.95     0.21
   9 โ”‚   0.778    0.979    0.345    0.417
  10 โ”‚   0.464    0.716    0.601    0.823
  11 โ”‚   0.211    0.655    0.226    0.191
  12 โ”‚   0.396    0.167    0.365    0.516
  โ‹ฎ  โ”‚    โ‹ฎ        โ‹ฎ        โ‹ฎ        โ‹ฎ
  90 โ”‚   0.043    0.334    0.471    0.663
  91 โ”‚   0.09     0.232    0.495    0.819
  92 โ”‚   0.659    0.719    0.629    0.985
  93 โ”‚   0.854    0.41     0.625    0.482
  94 โ”‚   0.833    0.47     0.575    0.76
  95 โ”‚   0.357    0.545    0.358    0.339
  96 โ”‚   0.556    0.263    0.098    0.164
  97 โ”‚   0.219    0.086    0.253    0.177
  98 โ”‚   0.674    0.899    0.418    0.006
  99 โ”‚   0.556    0.539    0.758    0.807
 100 โ”‚   0.927    0.899    0.285    0.936
                           77 rows omitted
  1. Iโ€™ve upload and download files over 100MB fine using the browser and the right+click download or the drag and drop to upload.
1 Like

How are you downloading those? Using the browser?

Right Click and Download, on the browser. But my dataset is 580 MB and I tried downloading even using more CPU and RAM but still did not run. Anyways I figured out, I really donโ€™t need all the columns just need a few. So I selected the oneโ€™s I need. Thanks againโ€ฆ!

Where are you downloading to? Florida?

Desktop for Plotting in R.