Metadata-Version: 2.4
Name: datasci-bricoletc
Version: 0.4.0
Summary: My utilities for basic data science
Project-URL: Documentation, https://github.com/bricoletc/datasci#readme
Project-URL: Issues, https://github.com/bricoletc/datasci/issues
Project-URL: Source, https://github.com/bricoletc/datasci
Author-email: Brice Letcher <brice.letcher@cnrs.fr>
License-Expression: MIT
License-File: LICENSE
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Requires-Python: >=3.7
Description-Content-Type: text/markdown

# datasci

## Tents: tabular entries

### Build a TSV

```python
from datasci import Tents

header = ["col1", "col2", "col3"]
tents = Tents(header=header)
for val1, val2, val3 in zip([1,2], [3,4], [5,6]):
    new_tent = tents.new()
    new_tent.update(col1=val1)
    new_tent.col2 = val2
    new_tent["col3"] = val3
    tents.add(new_tent)
with open("outfile.tsv", "w") as ofstream:
    print(tents, file=ofstream)
```

```sh
$cat outfile.tsv
col1	col2	col3
1	3	5
2	4	6
```

### Load a TSV

```python
from datasci import Tents

tents = Tents.from_tsv("outfile.tsv") # If the TSV does not have a header, you can also specify it with the 'header' argument
tents.sort(key_name="col1", descending=True)
print(tents)
```

```sh
col1	col2	col3
2	4	6
1	3	5
```
