-
-
Notifications
You must be signed in to change notification settings - Fork 349
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
read_csv does not work for species name with a comma #1372
Comments
@BangShiuh ... I think that csv being a 'comma-separated-list' by definition/default, this behavior is expected. So I do not believe that this is improper handling of output, but a problematic (i.e. difficult-to-parse) choice of species name. I'd recommend using a different output format (although even YAML may face similar issues; HDF may not), or replace the comma in the species name with a different character. |
I'm surprised this isn't handled by the |
|
I think this is worth fixing... This is a common enough convention for species naming to indicate a particular shape of the molecule, so I don't see "don't use those species" as a long term solution. As I said this is a known/solved problem if you have to embed the delimiter in the value for any *sv type file, so it may just take a little more configuration to resolve on the write side. |
I don’t have an issue with this, but would like to see solutions that are not API-centric. |
Could you clarify what you mean when you say API-centric? I think this could be easily solved by switching from |
Thanks for the link @cory-kinney! I think we probably don't want to introduce a hard dependency on pandas to this code. This link suggests a fix using the csv module which seems like it would work, although we'd probably want to adapt it for our specific use: https://stackoverflow.com/a/41930090 I'm not sure what Ingmar meant about API specific. I suspect he means that ideally the fix would be able to work for all the code that needs to read csv input, not just this one place in the Python interface. |
#1385 introduces a new C++ PS: likewise thanks for the link … I haven’t found a simple CSV library for C++ (and I’m not sure that it’s worth introducing a dependency for a relatively simple task), so this document is a nice reference |
Looks like it should be fairly simple with boost: https://bravenewmethod.com/2016/09/17/quick-and-robust-c-csv-reader-with-boost/ |
Of course! I found the link on Stack Overflow, naturally.
This looks like it would cover the main edge cases that we would encounter. No need to reinvent the wheel. |
Yup. PR’s are always welcome 😜 |
There should be no need to use Boost for this, by the way -- the C++ standard library now includes |
Now that #1426 is merged, all the infrastructure is in place to handle this in C++ as part of |
Problem description
read_csv does not properly handle a comma in a species name.
Ex. CH(1,3).
Line #2 (got "x" columns instead of "x+1")
x is the number of variables.
System information
Attachments
Additional context
The text was updated successfully, but these errors were encountered: