Comments (11)
from fast-cpp-csv-parser.
So I tried to use your parser but it either threw a missing column or extra column error, though I was using it correctly. When I changed the type of and used, it was able to run, but did not actually parse the row properly when I called read_row - it did not overwrite the variables I passed into the function. I'm not sure how to use this library at all.
from fast-cpp-csv-parser.
from fast-cpp-csv-parser.
https://raw.githubusercontent.com/kirnhans/15418-project/master/data/cancer/cancer_test.csv
is our dataset.
https://github.com/kirnhans/15418-project/blob/master/ParallelRandomForest.cpp#L11
is our code for using your parser.
Right now next_line will return the correct ASCII values, so long as the parser uses logical ands, but read_row does not work.
from fast-cpp-csv-parser.
Hi,
I cannot reproduce the problem. Consider this code:
#include "csv.h"
#include <iostream>
using namespace std;
int main(){
io::CSVReader<1> in("cancer_test.csv");
in.read_header(io::ignore_extra_column, "y");
int y;
cout << "y" << endl;
while(in.read_row(y)){
cout << y << endl;
}
return 0;
}
and the following shell code:
g++ main.cpp -std=c++11 -pthread -o foo
./foo > test.out
sed -E "s/^.*(.)$/\1/" < cancer_test.csv > sed.out
diff test.out sed.out
The diff has no output, i.e., the files are equal, i.e., the last column is correctly selected. The error seems to be in your code.
Best Regards
Ben Strasser
from fast-cpp-csv-parser.
Does the code still work when you use "in.set_file_line(index)"?
from fast-cpp-csv-parser.
Sorry about that - it turns out that one of the files wasn't correctly formatted.
When I use set_file_line and then read_row, it doesn't read the line which I used as the argument, but the line it was at previously. This is a problem because I want random accesses.
from fast-cpp-csv-parser.
from fast-cpp-csv-parser.
from fast-cpp-csv-parser.
from fast-cpp-csv-parser.
(edited to change "standard" to "RFC" as its just an RFC not an actual standard)
Sorry for the late reply,
The RFC for CSV specifies unescaped line breaks, they just need to be within quotes.
https://www.ietf.org/rfc/rfc4180.txt
See number 6
Fields containing line breaks (CRLF), double quotes, and commas
should be enclosed in double-quotes. For example:"aaa","b CRLF
bb","ccc" CRLF
zzz,yyy,xxx
Everyone has a different opinion of what a CSV format should be.
It would be nice if everyone just followed one format...
My branch of this project supports the RFC correctly (to my knowledge):
https://github.com/paulharris/cppcsv
It uses a state machine to parse the format, seems pretty quick.
Not sure if its as fast as your library though, I haven't had a chance to compare.
Best regards,
Paul
from fast-cpp-csv-parser.
Related Issues (20)
- How can i skip specified line? HOT 1
- Segmentation fault when running inside Boost Unit Test Framework HOT 2
- free(): invalid pointer HOT 4
- i18n README HOT 1
- My csv files can have changing number of columns
- Add ability to detect NULL values HOT 3
- Parse Single Line Without Loading File HOT 3
- Loss of precision on float reading HOT 4
- Indexing read_row HOT 1
- Count rows without processing them? HOT 1
- Possible to ignore columns in read_row()?
- Can the parsing performance be improved by using a precomputed index? HOT 2
- Progressbar support HOT 2
- Read file line by line
- Hope for more examples for code noobs
- Is it possible that I can wrap this library with lz4?
- Can I read the csv from console with this library?
- Usage of set_file_line is not clear HOT 1
- C4996 (function or variable may be unsafe) error for strncpy and fopen HOT 2
- Parsing a CSV with unknown number of columns HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fast-cpp-csv-parser.