Skip to content

Read CSV files quickly #884

@Beliavsky

Description

@Beliavsky

Since R is used for analyzing large data sets, there are several libraries for reading CSV files quickly, one of them being csvread, written in C++. It would be nice to have a fast CSV file reader in Fortran, even if it's just an interface to one in C or C++.

Activity

arjenmarkus

arjenmarkus commented on Nov 5, 2024

@arjenmarkus
Member
sakamoti

sakamoti commented on Nov 5, 2024

@sakamoti
Contributor

I have never loaded large data, so I am not sure how fast it is for your use case, but as a package for reading CSV files in Fortran, there is csv-fortran. This package is also introduced on fortran-lang.org.

jalvesz

jalvesz commented on Nov 5, 2024

@jalvesz
Contributor

This could be developed using to_num_from_stream. The fastest apporach I have found to load large numeric ASCII files into memory is to load it fully into a single large string and then stream throught the string pointer.

feenberg

feenberg commented on Feb 2, 2025

@feenberg

Can you say more about what you would expect from such a feature beyond what a list directed read can do? Would it be faster than the list directed read? Did you expect to avoid declaring the variables in the Fortran source? That would be super convenient, but probably out-of-scope for a compiled language like Fortran.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @arjenmarkus@feenberg@Beliavsky@sakamoti@jalvesz

        Issue actions

          Read CSV files quickly · Issue #884 · fortran-lang/stdlib