Mathematica从.csv导入大整数?

时间:2012-02-21 18:49:07

标签: csv import wolfram-mathematica biginteger scientific-notation

我正在将一些数据从CSV导入Mathematica。 CSV的前几行如下所示:

"a_use","tstart","tend"
"bind items on truck to prevent from flying off",1328661514469,1328661531032
"hang laundry on",1328661531035,1328661541700
"tie firewood with",1328661541702,1328661554940
"anchor tent",1328661554942,1328661559797

Mathematica几乎完美地处理了这个问题:

data = Import["mystuff.csv"]

问题是那些大的时间戳被转换成科学记数法,精确度会丢失:

In[283]:= data[[2,2]]
Out[283]= 1.32866*10^12

正如您所看到的,即使1328661531035与1328661541700不同,导入的数据也不再足够精确,无法区分两者,因为两者都导入为1.32866 * 10 ^ 12。我知道Mathematica可以处理任意长度的整数,那么我如何才能将它们作为(大)整数导入而不是将它们转换成这种有损的科学符号呢?

1 个答案:

答案 0 :(得分:4)

您使用的是哪个版本?在Mma 8.0.1上没问题。

enter image description here

如果要在Excel中创建CSV文件,请将时间戳的格式设置为带小数位零的数字(通过更多数字格式...)