Skip to content

CSV data loader #57

@garlontas

Description

@garlontas

Is your feature request related to a problem? Please describe.
It is always complicated to load data from CSV files. I need much code for reading CSV.

Describe the solution you'd like
I'd like to use a loader directly in the Stream.of(...) method.

Additional context
Currently:

data = []
with open('data.csv', 'r') as f:
    # Skip header
    next(f)
    for line in f:
        attr1, attr2 = line.split(',')
        data.append(Obj(attr1, attr2))

Stream.of(data)\
    ...

Solution:

Stream.of(csv("data.csv")\
    ...

The signature of the CSV loader could look like that:

def csv(file_path, delimiter=',')

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions