GeoDaCenter / spatial_access

https://spatial.uchicago.edu
37 stars 11 forks source link

Column of blank values in transit matrix output #26

Closed gyoliver closed 5 years ago

gyoliver commented 5 years ago

An extra column of blank string values (rightmost column) is getting written into the transit matrix. TransitMatrix.write_to_file() fails when it tries to cast the blank values as floats.

Below is the error that gets thrown:

Traceback (most recent call last):

File "command_line_test.py", line 87, in

upper=int(30))

File "/Users/georgeyoliver/GitHub/CSDS/GeoDaCenter/spatial_access/spatial_access/CommunityAnalytics.py", line 301, in init

self.load_sp_matrix(sp_matrix_filename)

File "/Users/georgeyoliver/miniconda3/envs/web_app/lib/python3.6/site-packages/spatial_access/ScoreModel.py", line 307, in load_sp_matrix

self.dicto[row[0]][int(float(self.dest_2[i]))] = int(float(row[i]))     

ValueError: could not convert string to float:

gyoliver commented 5 years ago

@lmnoel I believe the issue might be in writeCSV method in the C++ code? If it's a simple enough fix, do you think you could add it to master? It'll help me move forward with creating the web_app repo.

lmnoel commented 5 years ago

Give the new commit a try

lmnoel commented 5 years ago

Well... Looks like that commit broke something actually

gyoliver commented 5 years ago

No change here. I could remove the column with pandas as a quick temp fix if the issue is more involved than expected.

lmnoel commented 5 years ago

Yeah, if you could, that would probably be fastest. Sorry bout that, haven't pushed to master in ages because v1.4 is becoming larger and larger

gyoliver commented 5 years ago

Ok, will do!