CSV Import of array for matrix
See original GitHub issueI created a matrix array in a CSV file as I needed to make the array for ~500 different points that may need to change on a bi-monthly basis, so csv file feels like the best way to maintain this as opposed to manually creating and updating it within my_pathfinding_file.py
.
I used numpy and pandas to read the file and create the array, no problem; however when it spits out the array it looks like this:
matrix = [
[1 0 0 0 1]
]
instead of
matrix = [
[1, 0, 0, 0, 1]
]
Which returns an error when you try to run it through the grid.py
portion of your script. As best as I can understand it the grid.py
script requires the commas to be associated to a list
type of format, not an array of numbers; or what maybe considered a tuple
.
Would it be possible to add in this sort of functionality? I have looked into the articles below to best resolve the issue but my understanding of python is too limited to understand the greater problem nor how to implement it into the code you have already created. Grid from counting points CSV appending rows option
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (3 by maintainers)
The python-print for numpy does not print commas, but the print is just a visual representation, so it does not say anything about the internal data structure if there is a comma or not. I think it should be possible to use numpy arrays so I will investigate and reopen this issue. Can you provide me with the non-working code and/or error message?
Yes this fixed the problem. Sorry for late reply, got side-tracked on other porjects xD Thansk for the help!