Skip to main content

CSVM

CSVM is a file format that allows you to save multiple tables, add comments, and include metadata for both tables and columns

File format explanation

  1. Transform a .csv into a .csvm

    We start with a .csv

    first_name,last_name,instrument
    Syd,Barret,"guitar, vocals"
    David,Gilmour,"guitar, vocals"
    Roger,Waters,"bass, vocals"
    Richard,Wright,"keyboards, vocals"
    Nick,Mason,drums
    

    To transform it into a .csvm you add table attributes. Tha available table attributes are:

    • [_columns_] to define the column names
    • [_data_] to define the tabular data
    • [_table_meta_.any_key.with_nested_keys] to add table metadata
    • [_columns_meta_.any_key.with_nested_keys] to add column metadata.

    For now we add the attributes _columns_ and _data

    [_columns_]
    first_name,last_name,instrument
    [_data_]
    Syd,Barret,"guitar, vocals"
    David,Gilmour,"guitar, vocals"
    Roger,Waters,"bass, vocals"
    Richard,Wright,"keyboards, vocals"
    Nick,Mason,drums
    
  2. Add comments and blank lines

    Every line that starts with a # is ignored when parsing the file

    # Pink Floyd band members
    
    [_columns_]
    first_name,last_name,instrument
    
    [_data_]
    Syd,Barret,"guitar, vocals"
    David,Gilmour,"guitar, vocals"
    Roger,Waters,"bass, vocals"
    Richard,Wright,"keyboards, vocals"
    Nick,Mason,drums
    
  3. Add table metadata

    # Pink Floyd band members
    
    [_table_meta_.reference]
    "https://en.wikipedia.org/wiki/Pink_Floyd#Band_members"
    
    [_columns_]
    first_name,last_name,instrument
    
    [_data_]
    Syd,Barret,"guitar, vocals"
    David,Gilmour,"guitar, vocals"
    Roger,Waters,"bass, vocals"
    Richard,Wright,"keyboards, vocals"
    Nick,Mason,drums
    
  4. Add column metadata

    # Pink Floyd band members
    
    [_table_meta_.reference]
    "https://en.wikipedia.org/wiki/Pink_Floyd#Band_members"
    
    [_column_meta_.unique]
    true,true,false
    
    [_columns_]
    first_name,last_name,instrument
    
    [_data_]
    Syd,Barret,"guitar, vocals"
    David,Gilmour,"guitar, vocals"
    Roger,Waters,"bass, vocals"
    Richard,Wright,"keyboards, vocals"
    Nick,Mason,drums
    
  5. Save more than one table

    If you want to save more than one table you must use a namespace for each table.

    # Table 1 - Pink Floyd band members
    
    [members._table_meta_.reference]
    "https://en.wikipedia.org/wiki/Pink_Floyd#Band_members"
    
    [members._column_meta_.unique]
    true,true,false
    
    [members._columns_]
    first_name,last_name,instrument
    
    [members._data_]
    Syd,Barret,"guitar, vocals"
    David,Gilmour,"guitar, vocals"
    Roger,Waters,"bass, vocals"
    Richard,Wright,"keyboards, vocals"
    Nick,Mason,drums
    
    # Table 2 - Pink Floyd albums
    
    [albums._columns_]
    name,year
    [albums._data_]
    Animals,1997
    "The Dark Side of the Moon",1973
    

Read a .csvm file

Installation pip install csvm

import csvm

# Load TableCollection (if multiple tables) or Table (if one table)
tc = csvm.read_csvm("pink_floyd.csvm") 
print(tc.tables)
members = tc['members'] # get Table
# Access Table attributes if exist (i.e. Table.columns, Table.column_meta, Table.table_meta, Table.data, Table.name)
print(members.data) 

Release files for csvm 0.0.2

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

Source distribution (sdist)

Source distribution for csvm 0.0.2
File Size Uploaded
csvm-0.0.2.tar.gz 5.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for csvm 0.0.2
File Interpreter ABI Platform
csvm-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 10.0 kB

Release files / csvm-0.0.2.tar.gz

Download URL csvm-0.0.2.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
31c1480ee9bb7a3e275606ee1b5b5c1188dbe15720c288381e9fe1564e1890f7
BLAKE2b-256 checksum
How to use checksums
ac292b167aaf2033fecb6aaf75a21481497138be6d201a58319fb0aa081dc89d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.4

Release files / csvm-0.0.2-py3-none-any.whl

Download URL csvm-0.0.2-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2f58985de80a17973803955f5d1e8ff3068c22e1d66abc97372aaa86711dce5c
BLAKE2b-256 checksum
How to use checksums
89f38d6527a54642282a5adf0790f0a11494666eb9a27197dd864a25706ff7cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.4

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

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