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

too few colomns #37

Closed
skinkie opened this issue Feb 27, 2017 · 1 comment
Closed

too few colomns #37

skinkie opened this issue Feb 27, 2017 · 1 comment

Comments

@skinkie
Copy link

skinkie commented Feb 27, 2017

I'm trying to parse a GTFS file, with a certain number of columns. Is this code conceptually able to parse columns in a random order as long as they are mentioned in the header? Using this code:

    io::CSVReader<3> in("/mnt/volatile/skinkie/calgary/stops.txt");
    in.read_header(io::ignore_extra_column, "stop_id", "stop_lat", "stop_lon");
    std::string quaycoderef; float latitude; double longitude;
    while(in.read_row(quaycoderef, latitude, longitude)){

I get the following error:

terminate called after throwing an instance of 'io::error::too_few_columns'
  what():  Too few columns in line 2 in file "/mnt/volatile/skinkie/calgary/stops.txt".

With the data:

stop_id,stop_code,stop_name,stop_desc,stop_lat,stop_lon,zone_id,stop_url,location_type
112112,112112,"Crescent Heights High School",51.060931,-114.065158,,,0

I have also tried:

    io::CSVReader<3, io::trim_chars<' '>, io::double_quote_escape<',','\"'>> in("/mnt/volatile/skinkie/calgary/stops.txt");

and...

    io::CSVReader<9, io::trim_chars<' '>, io::double_quote_escape<',','\"'>> in("/mnt/volatile/skinkie/calgary/stops.txt");

    in.read_header(io::ignore_extra_column, "stop_id", "stop_code", "stop_name", "stop_desc", "stop_lat", "stop_lon", "zone_id", "stop_url", "location_type");
    std::string quaycoderef; std::string stop_code; std::string stop_name; std::string stop_desc; float latitude; double longitude; std::string zone_id; std::string stop_url; std::string location_type;
    while(in.read_row(quaycoderef, stop_code, stop_name, stop_desc, latitude, longitude, zone_id, stop_url, location_type)){
@skinkie
Copy link
Author

skinkie commented Feb 27, 2017

I noticed that the source data is missing a column. Closing this for now, I'll come with a better example.

@skinkie skinkie closed this as completed Feb 27, 2017
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

1 participant