Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReadCSV should take a Reader as input rather than a string #17

Closed
tobgu opened this issue Nov 13, 2016 · 3 comments
Closed

ReadCSV should take a Reader as input rather than a string #17

tobgu opened this issue Nov 13, 2016 · 3 comments

Comments

@tobgu
Copy link

tobgu commented Nov 13, 2016

I've started looking at reimplementing some of the functionality of https://github.com/tobgu/qcache in Go (currently python and pandas) and found gota. Looks good, keep it up!

I think it would be better to take a Reader as input to ReadCSV than a string. As it is right now I have to read all bytes from a reader into a byte buffer that then has to be converted to a string. That string is then immediately converted into a Reader in ReadCSV.

Do you agree?

@kniren
Copy link
Collaborator

kniren commented Nov 14, 2016

Hi @tobgu this makes complete sense. Reading from a Reader should be the preferred way of dealing with this.

In addition to this, it would also make sense that the Save methods would write to a Writer or WriteCloser for consistency and better composability.

The exception to this would be the ReadRecords/SaveRecords methods, but for other formats (CSV, JSON, XML...) it should work.

@tobgu
Copy link
Author

tobgu commented Nov 15, 2016

Sounds good!

@kniren
Copy link
Collaborator

kniren commented Nov 20, 2016

I've finished with these modifications on the dev branch as of commit 48ef419

As a summary:

  • ReadCSV now accepts an io.Reader instead of a string
  • SaveCSV/SaveJSON now write directly to the given io.Writer instead of returning a []byte
  • SaveRecords/SaveMaps has been renamed to Records/Maps respectively to be consistent with the Dense method
  • ReadCSV/ReadMaps has been renamed to LoadCSV/LoadMaps since they don't accept readers.
  • SaveCSV/SaveMaps has been renamed to WriteCSV/WriteMaps for consistency with the Read* methods.
  • SaveMaps was not working properly and thus it has been fixed.

@kniren kniren closed this as completed Nov 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants