Fix csv issue in the points_to_csv method #80
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The current
headerargument in thenp.savetxtcall inside of thepoints_to_csvmethod is not compatible with the format expected from theinitialize_dfmethod.A call to
initialize_dfwhen the argument is a pandas DataFrame constructed by reading the output ofpoints_to_csvwithpandas.read_csvwill fail because of a wrong format of the header.In particular, the issues here are the following:
the header of the csv file is generated with a leading pound character ('#') that comes from the default
comments='#'ofnp.savetxtthe column names are prefixed with an unnecessary space in by
', '.join(self.space.keys + ['target'])inside ofpoints_to_csv.This pull request fixes the above two issues. I tested these changes on a notebook that I am happy to share upon request.
At the cost of making
pandasan additional dependency, it may be easier to usepandasin methods such aspoints_to_csvandinitialize_df.