Skip to main content

No project description provided

Project description

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) 

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

csvm-0.0.2.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

csvm-0.0.2-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file csvm-0.0.2.tar.gz.

File metadata

  • Download URL: csvm-0.0.2.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.4

File hashes

Hashes for csvm-0.0.2.tar.gz
Algorithm Hash digest
SHA256 31c1480ee9bb7a3e275606ee1b5b5c1188dbe15720c288381e9fe1564e1890f7
MD5 97ae8d5ba2a990d0f3da8cd637a14cd0
BLAKE2b-256 ac292b167aaf2033fecb6aaf75a21481497138be6d201a58319fb0aa081dc89d

See more details on using hashes here.

File details

Details for the file csvm-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: csvm-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.4

File hashes

Hashes for csvm-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2f58985de80a17973803955f5d1e8ff3068c22e1d66abc97372aaa86711dce5c
MD5 13d9c2d3428ac71f678dc2797fc786e9
BLAKE2b-256 89f38d6527a54642282a5adf0790f0a11494666eb9a27197dd864a25706ff7cd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page