Le samedi 12 novembre 2016 à 05:53 -0800, [email protected] a écrit :
> Hello,
> I'm starting with Julia and wanted to use DataFrames in homeworks to
> present the data, but I've stumbled upon a problem.
> When running the below code you'll see three lists of Float64 values.
> 
> Problem is when I'm showing the DataFrame I'm loosing lots of
> information, because of the display precision.
> Is there a way to change it? In Pandas I would do
> Pandas.set_option('display.precision', 20).
I'm not sure I understand what result you want, but, I don't think
there's a way to set the precision at the moment. The best solution
would be to have a mechanism in Julia Base, which would apply equally
to arrays and data frames.


Regards

> xlist = [(1/8)^i for i=1:20]
> 
> fx = map(x -> sqrt(x^2 + 1) -1, xlist)
> gx = map(x -> x^2/(sqrt(x^2 + 1)+1), xlist)
> 
> println("|x                 | f(x)              | g(x)            
>  |")
> for i=1:20
>   # @printf("|%1.60f | %1.60f | %1.60f |\n", xlist[i], fx[i], gx[i])
>   println("$(xlist[i]) \t\t| $(fx[i]) \t\t| $(gx[i])")
> end
> 
> using DataFrames
> df = DataFrame(x = xlist, f_x = fx, g_x = gx)
> 
> # rename!(df, ["b", "c"], ["f(x)", "g(x)"])
> showall(df)
> println("\n")
> 
> 
> 
> |x                 | f(x)              | g(x)              |
> 0.125                 | 0.0077822185373186414                 |
> 0.0077822185373187065
> 0.015625              | 0.00012206286282867573                |
> 0.00012206286282875901
> 0.001953125           | 1.9073468138230965e-6                 |
> 1.907346813826566e-6
> 0.000244140625                | 2.9802321943606103e-8                 
> | 2.9802321943606116e-8
> 3.0517578125e-5               | 4.656612873077393e-10                 
> | 4.6566128719931904e-10
> 3.814697265625e-6             | 7.275957614183426e-12                 
> | 7.275957614156956e-12
> 4.76837158203125e-7           | 1.1368683772161603e-13                
> | 1.1368683772160957e-13
> 5.960464477539063e-8          | 1.7763568394002505e-15        
>       | 1.7763568394002489e-15
> 7.450580596923828e-9          | 0.0           |
> 2.7755575615628914e-17
> 9.313225746154785e-10                 | 0.0           |
> 4.336808689942018e-19
> 1.1641532182693481e-10                | 0.0           |
> 6.776263578034403e-21
> 1.4551915228366852e-11                | 0.0           |
> 1.0587911840678754e-22
> 1.8189894035458565e-12                | 0.0           |
> 1.6543612251060553e-24
> 2.2737367544323206e-13                | 0.0           |
> 2.5849394142282115e-26
> 2.842170943040401e-14                 | 0.0           |
> 4.0389678347315804e-28
> 3.552713678800501e-15                 | 0.0           |
> 6.310887241768095e-30
> 4.440892098500626e-16                 | 0.0           |
> 9.860761315262648e-32
> 5.551115123125783e-17                 | 0.0           |
> 1.5407439555097887e-33
> 6.938893903907228e-18                 | 0.0           |
> 2.407412430484045e-35
> 8.673617379884035e-19                 | 0.0           |
> 3.76158192263132e-37
> 20×3 DataFrames.DataFrame
> │ Row │ x           │ f_x         │ g_x         │
> ├─────┼─────────────┼─────────────┼─────────────┤
> │ 1   │ 0.125       │ 0.00778222  │ 0.00778222  │
> │ 2   │ 0.015625    │ 0.000122063 │ 0.000122063 │
> │ 3   │ 0.00195313  │ 1.90735e-6  │ 1.90735e-6  │
> │ 4   │ 0.000244141 │ 2.98023e-8  │ 2.98023e-8  │
> │ 5   │ 3.05176e-5  │ 4.65661e-10 │ 4.65661e-10 │
> │ 6   │ 3.8147e-6   │ 7.27596e-12 │ 7.27596e-12 │
> │ 7   │ 4.76837e-7  │ 1.13687e-13 │ 1.13687e-13 │
> │ 8   │ 5.96046e-8  │ 1.77636e-15 │ 1.77636e-15 │
> │ 9   │ 7.45058e-9  │ 0.0         │ 2.77556e-17 │
> │ 10  │ 9.31323e-10 │ 0.0         │ 4.33681e-19 │
> │ 11  │ 1.16415e-10 │ 0.0         │ 6.77626e-21 │
> │ 12  │ 1.45519e-11 │ 0.0         │ 1.05879e-22 │
> │ 13  │ 1.81899e-12 │ 0.0         │ 1.65436e-24 │
> │ 14  │ 2.27374e-13 │ 0.0         │ 2.58494e-26 │
> │ 15  │ 2.84217e-14 │ 0.0         │ 4.03897e-28 │
> │ 16  │ 3.55271e-15 │ 0.0         │ 6.31089e-30 │
> │ 17  │ 4.44089e-16 │ 0.0         │ 9.86076e-32 │
> │ 18  │ 5.55112e-17 │ 0.0         │ 1.54074e-33 │
> │ 19  │ 6.93889e-18 │ 0.0         │ 2.40741e-35 │
> │ 20  │ 8.67362e-19 │ 0.0         │ 3.76158e-37 │
> -- 
> You received this message because you are subscribed to the Google
> Groups "julia-stats" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to [email protected].
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"julia-stats" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to