Comments (1)
Hi @vagrawal-aptina - yes, this should be supported by rapidcsv
.
Let's say the CSV file content is:
# Line 0 with no CSV data
# Line 1 with no CSV data
# Line 2 with no CSV data
Date,Open,High,Low,Close,Volume,Adj Close
2017-02-24,64.529999,64.800003,64.139999,64.620003,21705200,64.620003
2017-02-23,64.419998,64.730003,64.190002,64.620003,20235200,64.620003
2017-02-22,64.330002,64.389999,64.050003,64.360001,19259700,64.360001
2017-02-21,64.610001,64.949997,64.449997,64.489998,19384900,64.489998
2017-02-17,64.470001,64.690002,64.300003,64.620003,21234600,64.620003
2017-02-16,64.739998,65.239998,64.440002,64.519997,20524700,64.519997
Then we can tell rapidcsv
that the column headers (Date,Open,High,Low,...
) are at line 3 using the LabelParams argument, like this:
int main()
{
rapidcsv::Document doc("examples/rowoffset.csv", rapidcsv::LabelParams(3, -1));
std::cout << "First data row date: " << doc.GetColumn<std::string>("Date").at(0) << "\n";
}
The expected output of this program will be:
First data row date: 2017-02-24
Hope this illustrates how the row offset works. Feel free to re-open the issue if you have follow-up questions!
from rapidcsv.
Related Issues (20)
- Removing Columns HOT 12
- std::string_view support HOT 3
- sign-conversion warnings HOT 3
- Make quoting character configurable HOT 2
- `pTrim` unexpectedly fails when `pSeparator` is the space character HOT 2
- [bug] Test errors occur when running `winmake.bat` on non-utf8 default encoding platform. HOT 2
- Provide imported target "rapidcsv::rapidcsv" and config files for CMake find_package HOT 4
- [bug] Cannot run `winmake.bat` directly to configure and build the project on Windows. HOT 1
- Add documentation for using package managers vcpkg/conan to fetch rapidcsv HOT 2
- Incorrect precision in default Converter.ToStr() depending on type HOT 2
- `mNumericLocale` only considers C-locale, but not C++-locale HOT 2
- Setting cell value is not working correctly with column headers offset
- Conflict caused by `typedef SSIZE_T ssize_t;` HOT 5
- Retain UTF-8 BOM on Save
- Add two SetCell methods for consistency with GetCell HOT 1
- basic_ios::clear: iostream error HOT 4
- openSUSE 15.4 / g++ v7.5.0 build warnings
- CSV files ending with a commented line without a line-break will result in the commented line as part of the final data HOT 2
- Reading empty lines not possible HOT 2
- string contains '\n' ,but not quoted HOT 4
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 rapidcsv.