Skip to content

ENH: support reading from several files for read_* functions #39435

Open
@anmyachev

Description

@anmyachev

Is your feature request related to a problem?

In general, the implementation of this idea should contribute to simplification of reading functions use and reduce the use of boilerplate code.
On the other hand, this shouldn't make it much more difficult to maintain that functions in Pandas.

Current reading approach (from Pandas docs):

  import glob
  files = glob.glob('file_*.csv')
  result = pd.concat([pd.read_csv(f) for f in files], ignore_index=True)

Describe the solution you'd like

We can make reading several files as "out-of-the-box" feature of Pandas (with using wildcard):

  result = pd.read_csv('file_*csv')

API breaking implications

In one of the two proposed solutions: filepath_or_buffer also can be of list[str] type.
Changes do not break backward compatibility.

Describe alternatives you've considered

Another possible option (using list of files in read_* call):

  import glob
  result = pd.read_csv(glob.glob('file_*csv'))

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementIO DataIO issues that don't fit into a more specific labelNeeds DiscussionRequires discussion from core team before further action

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions