将列表转换为double [英] converting a list to double

查看:76
本文介绍了将列表转换为double的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。我有一个名为linearRegression()的函数。现在我正在完成这个功能atm。关于这个函数:该函数执行一个SQL查询,从我的数据库中名为Yahoo的表中获取一列。现在,这里的事情变得越来越模糊。我需要能够对这个结果集执行数学运算,即。找到rsquared值,斜率,平均值等.....但我现在不能在列表中做任何这个。我尝试将列表创建为特定类型列表列表,但无论出于什么原因,eclipse都给了我错误。我已经尝试将我的列表转换为多次加倍而没有任何结果。任何指导表示赞赏。

Hi again folks. I have a function called "linearRegression()" now I am along way from finishing this function atm. A little about this function: The function executes an SQL query grabbing a column from a table in my database called "Yahoo". Now here is where things are getting fuzzy for me. I need to be able to perform mathematical operations on this result set ie. finding the rsquared value, slope, average etc..... but i cannot do any of this on the list at is is now. I have tried created the list as a "type specific" list, but for whatever reason eclipse is giving me errors. I have tried converting my list to doubles numerous times without any results. Any guidance is appreciated.

展开 | 选择 | Wrap | 行号

推荐答案


再次大家好。我有一个名为linearRegression()的函数。现在我正在完成这个功能atm。关于这个函数:该函数执行一个SQL查询,从我的数据库中名为Yahoo的表中获取一列。现在,这里的事情变得越来越模糊。我需要能够对这个结果集执行数学运算,即。找到rsquared值,斜率,平均值等.....但我现在不能在列表中做任何这个。我尝试将列表创建为特定类型列表列表,但无论出于什么原因,eclipse都给了我错误。我已经尝试将我的列表转换为多次加倍而没有任何结果。任何指导表示赞赏。
Hi again folks. I have a function called "linearRegression()" now I am along way from finishing this function atm. A little about this function: The function executes an SQL query grabbing a column from a table in my database called "Yahoo". Now here is where things are getting fuzzy for me. I need to be able to perform mathematical operations on this result set ie. finding the rsquared value, slope, average etc..... but i cannot do any of this on the list at is is now. I have tried created the list as a "type specific" list, but for whatever reason eclipse is giving me errors. I have tried converting my list to doubles numerous times without any results. Any guidance is appreciated.
展开 | 选择 | Wrap | 行号


对不起m8。没有当前的功能给我没有错误。但我不能对它进行数学运算。例如:


double sum = list(0)+ list(1);


不起作用,因为列表元素是对象。我需要一种方法将它们转换成双打......这可能比我制作它容易得多。但到目前为止,重复的尝试除了雾之外什么也没做。我的代码。
Sorry m8. No that current function gives me no errors. But I cannot perform math operations on it. for example:

double sum = list(0) + list(1);

will not work because the list elements are objects. I need a way to convert them to doubles... this is probably much easier then I am making it. But thus far repeated attempts have done nothing but "fog" up my code.



对不起m8。没有当前的功能给我没有错误。但我不能对它进行数学运算。例如:


double sum = list(0)+ list(1);


不起作用,因为列表元素是对象。我需要一种方法将它们转换成双打......这可能比我制作它容易得多。但到目前为止,重复的尝试除了雾之外什么也没做。我的代码。
Sorry m8. No that current function gives me no errors. But I cannot perform math operations on it. for example:

double sum = list(0) + list(1);

will not work because the list elements are objects. I need a way to convert them to doubles... this is probably much easier then I am making it. But thus far repeated attempts have done nothing but "fog" up my code.



不要使用代码字,这是一个论坛而不是聊天室:-)

并具体说明你的问题。

您确定列表中存储的内容可以解析为双倍吗?

然后查看此代码。

Don''t use code words, it''s a forum not a chatting room :-)
And be specific about your problem.
Are you sure that what you store in list that can be parsed as double?
Then have a look at this code.

展开 | 选择 | Wrap | 行号


这篇关于将列表转换为double的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆