Google Datalab和Python问题

时间:2017-08-29 17:07:22

标签: python google-cloud-datalab

我有一个python脚本,可以在我的本地计算机上的IDE中完美运行,但是当我在Google Datalab上运行它时会抛出此错误:

ValueError:无法将字符串转换为float:' 80,354'

代码很简单,图表在我的Pycharm IDE中打印,但不在GoogleDatalab上打印。

plt.plot(new_df ['卷']) plt.show()

错误与数据中的最后一行有关。我使用日期作为索引。这是数据的样子?有些斜线丢失吗?我做错了什么或错过了什么?

'微型市场交易量\ n月/年\ n2014-01-01达拉斯-FT值63,974 \ n2014-02-01达拉斯-FT值68,482 \ n2014-03-01达拉斯-FT值得85,866 \ n2014-04-01达拉斯-FT值得信赖79,735 \ n2014-05-01 DALLAS-FT WORTH 75,339 \ n2014-06-01 DALLAS-FT WORTH 71,739 \ n2014-07-01 DALLAS-FT WORTH 85,893 \ n2014-08-01 DALLAS-FT WORTH 83,694 \ n2014-09- 01 DALLAS-FT WORTH 87,567 \ n2014-10-01 DALLAS-FT WORTH 87,389 \ n2014-11-01 DALLAS-FT WORTH 68,340 \ n2014-12-01 DALLAS-FT WORTH 74,805 \ n2015-01-01 DALLAS-FT WORTH 68,568 \ n2015-02-01达拉斯-FT值得61,924 \ n2015-03-01达拉斯-FT值得56,885 \ n2015-04-01达拉斯-FT值得68,101 \ n2015-05-01达拉斯-FT值得52,806 \ n2015-06-01 DALLAS-FT值得79,918 \ n2015-07-01达拉斯-FT值得92,134 \ n2015-08-01达拉斯-FT值得88,047 \ n2015-09-01达拉斯-FT值得91,377 \ n2015-10-01达拉斯-FT值得91,307 \ n2015-11-01达拉斯-FT值65,415 \ n2015-12-01达拉斯-FT值得81,456 \ n2016-01-01达拉斯-FT值得信赖82,820 \ n2016-02-01 DALLAS-FT WORTH 91,688 \ n2016-03-01 DALLAS-FT WORTH 81,495 \ n2016-04-01 DALLAS-FT WORTH 87,872 \ n2016-05-01 DALLAS-FT WORTH 82,031 \ n2016-06- 01 DALLAS-FT值得100,783 \ n2016-07-01达拉斯-FT值得99,285 \ n2016-08-01达拉斯-FT值得99,179 \ n2016-09-01达拉斯-FT值得93,939 \ n2016-10-01达拉斯-FT WORTH 99,663 \ n2016-11-01 DALLAS-FT WORTH 86,751 \ n2016-12-01 DALLAS-FT WORTH 84,551 \ n2017-01-01 DALLAS-FT WORTH 81,890 \ n2017-02-01 DALLAS-FT WORTH 90,212 \ n2017-03-01 DALLAS-FT值得97,798 \ n2017-04-01 DALLAS-FT值得89,338 \ n2017-05-01达拉斯-FT值得96,891 \ n2017-06-01达拉斯-FT值得86,613 \ n2017-07-01达拉斯-FT值得80,354& #39;

1 个答案:

答案 0 :(得分:0)

我正在不恰当地加载数据。我在我的本地机器上使用pandas load_csv,在Datalab中使用BytesIO。数字值中的逗号放弃了数据的导入。我不得不说分隔符是","千分隔符也是","