Skip to main content

icsv

iCSV logo

icsv is a Python package for reading, writing, validating, and transforming interoperable CSV (iCSV) files.

Note: this repository provides the Python interface for iCSV. The iCSV format specification itself is maintained in EnviDat/icsv: https://gitlabext.wsl.ch/EnviDat/icsv

It supports:

  • Standard iCSV files (# iCSV 1.0 UTF-8)
  • 2D timeseries application profile files (# iCSV 1.0 UTF-8 2DTIMESERIES)
  • Conversion of SMET-like objects into iCSV structures

Installation

pip install interoperable-csv

Import path stays:

import icsv

What Is iCSV?

iCSV is a text-based, self-describing data format for environmental time series. It combines CSV data rows with structured header metadata.

An iCSV file is organized in sections:

  • [METADATA]: global attributes (station info, geometry, delimiter, etc.)
  • [FIELDS]: column definitions and per-column attributes
  • [DATA]: tabular data rows

Typical header example:

# iCSV 1.0 UTF-8
# [METADATA]
# field_delimiter = ,
# geometry = POINTZ(9.81 46.831 2540.0)
# srid = EPSG:4326
# [FIELDS]
# fields = timestamp,hs
# [DATA]

Required metadata keys for standard files:

  • field_delimiter
  • geometry
  • srid

Quickstart

import icsv

f = icsv.read("input.icsv")
print(f.get_field("fields"))
print(f.get_metadata("station_id"))
f.write("copy.icsv")

Create a new file:

import pandas as pd
import icsv

f = icsv.iCSVFile()
f.set_metadata("field_delimiter", ",")
f.set_metadata("geometry", "POINTZ(8.0 47.0 1200)")
f.set_metadata("srid", "EPSG:4326")
f.set_metadata("station_id", "WFJ")
f.set_fields("fields", ["timestamp", "hs"])
f.setData(pd.DataFrame({"timestamp": ["2024-01-01T00:00:00"], "hs": [40.2]}))
f.write("out.icsv")

2D timeseries profile support:

  • icsv.iCSV2DTimeseries for read/write of [DATE=...] blocks
  • icsv.append_timepoint(...) to append profile timesteps

Core API:

  • icsv.read(path) auto-detects standard vs 2D profile format
  • icsv.iCSVFile standard iCSV object
  • icsv.iCSV2DTimeseries profile object
  • icsv.from_smet(smet_obj) SMET to iCSV conversion

Documentation

Project documentation:

For iCSV format specification changes, open issues at:

Metadata

Release files for interoperable-csv 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for interoperable-csv 0.2.1
File Size Uploaded Provenance Actions
interoperable_csv-0.2.1.tar.gz 21.4 kB Without provenance Details for interoperable_csv-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for interoperable-csv 0.2.1
File Interpreter ABI Platform Actions
interoperable_csv-0.2.1-py3-none-any.whl Python 3 none any Details for interoperable_csv-0.2.1-py3-none-any.whl

Total release size: 44.9 kB

Release files / interoperable_csv-0.2.1.tar.gz

Download URL interoperable_csv-0.2.1.tar.gz
Size 21.4 kB
Tags Source
SHA-256 checksum
How to use checksums
55653c701d306a2959c61694436d456db6a0f54aaeafa1dc461b01c06dbe4ad7
BLAKE2b-256 checksum
How to use checksums
2bd31dbbe8d87232a4ad6727ea606357db3cbf061c8866b0ae748de43d170c3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release files / interoperable_csv-0.2.1-py3-none-any.whl

Download URL interoperable_csv-0.2.1-py3-none-any.whl
Size 23.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1b50f46c39a89f042f80e75d3a91c3f2fe408de0e90edffe4ed4d95be445eb88
BLAKE2b-256 checksum
How to use checksums
1968cc21e8844cd7fbcbfce277927a79f5a53523bf9b750f2b956715493a7fdd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Security for interoperable-csv 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page