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

TrimSplitLineTrimColumnsToDictionary throws a "key already exists" exception #125

Open
david-clinch opened this issue Oct 3, 2019 · 1 comment

Comments

@david-clinch
Copy link

Hi guys!
First off, great job! SharpLearning is very useful and well built.

One small bug I found while mistakenly creating a dataset based on a CSV file without the headers line (when calling 'ToF64Matrix()').

In SharpLearning.InputOutput.Csv.CsvParser -> Dictionary<string, int> TrimSplitLineTrimColumnsToDictionary(string line)
there's an iteration over the headers line, but it assumes all headers are distinct (and also that it is the headers line) - therefore an exception of "key already exists in dictionary" is thrown.
I think it should check if there's a duplication and throw a more explanatory error message in such case.

Let me know if you want me to fix it and add a pull request.

@mdabros
Copy link
Owner

mdabros commented Oct 3, 2019

Hi @david-clinch,

I am glad you find SharpLearning useful - thanks!

You are welcome to create a pull request with a fix, and a more explanatory error message, that would be great!

If you go ahead with this, please write a unit test that fails/shows the error before the fix, and passes after the fix has been implemented. This makes it a lot easier to understand, and review the bug and solution :-).

best regards
Mads

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants