Google Datalab and Python Issue

82 views Asked by At

I have a python script that runs perfectly in my IDE on my local machine, but when I run it on Google Datalab, it throws this error:

ValueError: could not convert string to float: '80,354'

The code is simple, and the graph prints in my Pycharm IDE, but not on GoogleDatalab.

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

The error is related to the last line in the data. I'm using the date as an index. Here's what the data looks like? Is there a slash missing somehwere? What am I doing wrong or missing?

' Micro Market Volume\nMonth/Year \n2014-01-01 DALLAS-FT WORTH 63,974\n2014-02-01 DALLAS-FT WORTH 68,482\n2014-03-01 DALLAS-FT WORTH 85,866\n2014-04-01 DALLAS-FT WORTH 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 DALLAS-FT WORTH 61,924\n2015-03-01 DALLAS-FT WORTH 56,885\n2015-04-01 DALLAS-FT WORTH 68,101\n2015-05-01 DALLAS-FT WORTH 52,806\n2015-06-01 DALLAS-FT WORTH 79,918\n2015-07-01 DALLAS-FT WORTH 92,134\n2015-08-01 DALLAS-FT WORTH 88,047\n2015-09-01 DALLAS-FT WORTH 91,377\n2015-10-01 DALLAS-FT WORTH 91,307\n2015-11-01 DALLAS-FT WORTH 65,415\n2015-12-01 DALLAS-FT WORTH 81,456\n2016-01-01 DALLAS-FT WORTH 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 WORTH 100,783\n2016-07-01 DALLAS-FT WORTH 99,285\n2016-08-01 DALLAS-FT WORTH 99,179\n2016-09-01 DALLAS-FT WORTH 93,939\n2016-10-01 DALLAS-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 WORTH 97,798\n2017-04-01 DALLAS-FT WORTH 89,338\n2017-05-01 DALLAS-FT WORTH 96,891\n2017-06-01 DALLAS-FT WORTH 86,613\n2017-07-01 DALLAS-FT WORTH 80,354'

1

There are 1 answers

0
Junaid Athar On

I was loading the data inappropriately. I was using pandas load_csv on my local machine, and BytesIO on in Datalab. The comma in the numberical value was throwing off the import of the data. I had to say that the delimiter is a "," and the thousand separator is also a ","