Skip to content

Feature request: read_csv/read_table/read_fwf - read multiple files with the same structure, applying the same parameters (skiprows, skipfooter, nrows) #12618

Closed
@maxu777

Description

@maxu777

Hello,

I think it would make sense to make read_csv(), read_table(), read_fwf() able to read multiple files with the same structure. It might be tricky to read multiple files into one string, especially when all of them have header line(s) and when you want to use the following parameters: skiprows, skipfooter, nrows.
The logic for (skiprows, skipfooter, nrows) is already implemented, so IMO it shouldn't be very difficult. The header parameter (if header exists) must be read/parsed only from the first (from one) file.

Of course one can always do something like:

df = pd.concat([pd.read_csv(f, **kwargs) for f in flist], ignore_index=True)

but it's not very efficient when working with big files.

In the last days there were plenty of similar questions stackoverflow.com, asking how to merge CSV files with the same structure.

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    API DesignDocsIO CSVread_csv, to_csvIO DataIO issues that don't fit into a more specific label

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions