Skip to content

ReadCsv

Base classes

Name Children Inherits
ReadOp
datacook.engine.ops.sources
A reader: a source op with file extensions (the format registry looks them up).

⋔ Inheritance diagram

graph TD
  1938171446["sources.ReadCsv"]
  1625742177["sources.ReadOp"]
  3484306131["base.CallOp"]
  1539482213["base.Op"]
  2751680898["builtins.object"]
  1625742177 --> 1938171446
  3484306131 --> 1625742177
  1539482213 --> 3484306131
  2751680898 --> 1539482213

🛈 DocStrings

Bases: ReadOp

Source code in src/datacook/engine/ops/sources.py
class ReadCsv(ReadOp):
    id = "read_csv"
    format_id = "csv"
    title = _("CSV file")
    description = _("Read a comma separated values file.")
    function = "pd.read_csv"
    extensions = (".csv", ".tsv", ".txt")

    class Params(base.Params):
        path: str = Field(title=N_("File"), json_schema_extra={"widget": "file"})
        sep: str | None = Field(",", title=N_("Separator"))
        decimal: str = Field(".", title=N_("Decimal separator"))
        encoding: str | None = Field(None, title=N_("Encoding"))
        skiprows: int | None = Field(None, title=N_("Skip rows"), ge=0)
        dtype_backend: DtypeBackend = Field("pyarrow", title=N_("Data types"))

:fa-brands-github: Show source on GitHub