scientific-notation

Parsing scientific notation sensibly?

空扰寡人 提交于 2019-11-26 00:59:49
问题 I want to be able to write a function which receives a number in scientific notation as a string and splits out of it the coefficient and the exponent as separate items. I could just use a regular expression, but the incoming number may not be normalised and I\'d prefer to be able to normalise and then break the parts out. A colleague has got part way of an solution using VB6 but it\'s not quite there, as the transcript below shows. cliVe> a = 1e6 cliVe> ? \"coeff: \" & o.spt(a) & \" exponent

Format / Suppress Scientific Notation from Python Pandas Aggregation Results

被刻印的时光 ゝ 提交于 2019-11-26 00:40:53
问题 How can one modify the format for the output from a groupby operation in pandas that produces scientific notation for very large numbers? I know how to do string formatting in python but I\'m at a loss when it comes to applying it here. df1.groupby(\'dept\')[\'data1\'].sum() dept value1 1.192433e+08 value2 1.293066e+08 value3 1.077142e+08 This suppresses the scientific notation if I convert to string but now I\'m just wondering how to string format and add decimals. sum_sales_dept.astype(str)

Force R not to use exponential notation (e.g. e+10)?

微笑、不失礼 提交于 2019-11-26 00:23:49
问题 Can I force R to use regular numbers instead of using the e+10 -like notation? I have: 1.810032e+09 # and 4 within the same vector and want to see: 1810032000 # and 4 I am creating output for an old fashioned program and I have to write a text file using cat . That works fine so far but I simply can\'t use the e+10 notation there. 回答1: This is a bit of a grey area. You need to recall that R will always invoke a print method, and these print methods listen to some options. Including 'scipen' -

How to disable scientific notation?

此生再无相见时 提交于 2019-11-26 00:13:56
问题 I have a dataframe with a column of p-values and I want to make a selection on these p-values. > pvalues_anova [1] 9.693919e-01 9.781728e-01 9.918415e-01 9.716883e-01 1.667183e-02 [6] 9.952762e-02 5.386854e-01 9.997699e-01 8.714044e-01 7.211856e-01 [11] 9.536330e-01 9.239667e-01 9.645590e-01 9.478572e-01 6.243775e-01 [16] 5.608563e-01 1.371190e-04 9.601970e-01 9.988648e-01 9.698365e-01 [21] 2.795891e-06 1.290176e-01 7.125751e-01 5.193604e-01 4.835312e-04 Selection way: anovatest<- results[ -

Parsing scientific notation sensibly?

痞子三分冷 提交于 2019-11-25 22:08:37
I want to be able to write a function which receives a number in scientific notation as a string and splits out of it the coefficient and the exponent as separate items. I could just use a regular expression, but the incoming number may not be normalised and I'd prefer to be able to normalise and then break the parts out. A colleague has got part way of an solution using VB6 but it's not quite there, as the transcript below shows. cliVe> a = 1e6 cliVe> ? "coeff: " & o.spt(a) & " exponent: " & o.ept(a) coeff: 10 exponent: 5 should have been 1 and 6 cliVe> a = 1.1e6 cliVe> ? "coeff: " & o.spt(a)

Format / Suppress Scientific Notation from Python Pandas Aggregation Results

一笑奈何 提交于 2019-11-25 18:56:12
How can one modify the format for the output from a groupby operation in pandas that produces scientific notation for very large numbers? I know how to do string formatting in python but I'm at a loss when it comes to applying it here. df1.groupby('dept')['data1'].sum() dept value1 1.192433e+08 value2 1.293066e+08 value3 1.077142e+08 This suppresses the scientific notation if I convert to string but now I'm just wondering how to string format and add decimals. sum_sales_dept.astype(str) Granted, the answer I linked in the comments is not very helpful. You can specify your own string converter