我可以更改 j 中的数据类型吗

Can I change datatype in j

我在 j 中的 table 中加载了我的数据。因为它们都是价格,我需要计算 returns,所以我意识到所有单元格的数据类型都是文字。如何将其更改为浮动类型?谢谢!

只要字面量都是数字就可以使用二进".(Numbers)

http://www.jsoftware.com/help/dictionary/d601.htm

左边的参数是一个数字,它将替换任何非法字符。

   3 10 $ '23 223 1  3 5 334.05 1 4 3.6e3' NB. String
23 223 1  
3 5 334.05
 1 4 3.6e3
   0 ". 3 10 $ '23 223 1  3 5 334.05 1 4 3.6e3' NB. conversion to numeric
23 223      1
 3   5 334.05
 1   4   3600
   2 * 0 ". 3 10 $ '23 223 1  3 5 334.05 1 4 3.6e3' NB. Multiplying wouldn't work if it was a string!
46 446     2
 6  10 668.1
 2   8  7200

可能需要做一些工作来确保文字 table 全部是数字符号(". 不会转换“$”或字母字符。

   0 ". '.01' NB. returns 0 since '$'is not numeric
0