Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jferard/csvtransformer

CSV Transformer - A CSV Transformer library in Python
https://github.com/jferard/csvtransformer

Last synced: 1 day ago
JSON representation

CSV Transformer - A CSV Transformer library in Python

Awesome Lists containing this project

README

        

# CSV Transformer - A CSV Transformer library in Python

Copyright (C) 2022 J. Férard

License: GPLv3

This is a POC. See tests to understand the goal of the library.

## Format of the transformation dict
All entries are optional.

### The entity filter
Format :
```
"entity_filter" :
```

This filter lines before aggregating them.

### The default column transformation
Format :
```
"default_col" : {
"normalize":
"visible":
}
```

* `"normalize"` means that the column names are normalized by default. This can be overrided by col `"rename"` attribute.
* `"visible"` means that columns are visible by default. This can be overrided by col `"visible"` attribute.

### The columns transformations
Format :
```
"cols" : {
"": ,
...
}
```

#### A column transformation
Format :
```
"": {
"visible":
"id"
"type": >
"filter"
"map"
"rename"
"agg"
}
```

* `"visible"`: means that the column is visible.
* `"type"`: the name of a type, or an expression

### The new columns (TODO)
Format :
```
"new_cols" : [
,
...
]
```

### A new column (TODO)
Format :
```
"": {
"visible":
"id"
"filter"
"formula"
"rename"
"agg"
}
```

### The aggregate filter (TODO)
Format :
```
"agg_filter" :
```

Filters after aggregation.

## Expressions
### Data Types
Simple data types

### Operators

### Functions

## Test
```
python3 -m pytest --cov-report term-missing --cov=csv_transformer && python3 -m pytest --cov-report term-missing --ignore=test --cov-append --doctest-modules --cov=csv_transformer
```