Skip to content

Commit

Permalink
update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
SongminYu committed Dec 3, 2023
1 parent 3c213d1 commit 8ab3d42
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ Second, "Relation" tables, for example, the `Relation_Position_ProjectType` tabl
| 3 | 3 |

Third, "Data" tables, for example, the `Data_ProjectSize` table:
* There can be multiple index columns.
* There can be multiple index columns.
* For timeseries input, besides the `id_` index columns, `tab2dict` also has `period` as a usable index column name.
* The `unit` column is optional.
* The name of the last column must be `value`.

Expand All @@ -65,6 +66,7 @@ Third, "Data" tables, for example, the `Data_ProjectSize` table:
| 2 | 3 | Euros | 80 |
| 3 | 3 | Euros | 50 |


### TabKey

`tab2dict` provides the base class `TabKey` that has to be inherited and extended according to the input table columns.
Expand All @@ -83,8 +85,15 @@ class TestTabKey(TabKey):
```

As shown, the attributes of the `TestTabKey` class are same with the column names in the input tables.
They must always start with `id_`, also as shown above.
Furthermore, to include timeseries table, `tab2dict` also has `period` as a default column name.
They must always start with `id_` (or `period`) as shown above.

### Summary

* When converting a table to a `TabDict` instance (`tdict`), the index columns are automatically identified and recorded as its `key_cols`.
* Users can use `TabKey` instances (`tkey`) to fetch data from the dict, as long as the `tkey` knows the values of the `tdict`'s `key_cols`.
* The `tkey` can know more than necessary, which means
* removing an index column from an input table will not cause code changes;
* adding a new index column in the input table may neither, as long as the `tkey` knows the added column.

## Dependencies

Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
version="0.0.1",
description="tab2dict supports data handing in developing scientific software.",
long_description="`tab2dict` supports data handling in developing of scientific software (i.e., models). "
"It can convert predefined input tables (`.xlsx` or `.csv`) into `TabDict` instances. "
"Then, the items therein can be fetched by `TabKey` instances.",
"It can convert predefined input tables (`.xlsx` or `.csv`) into `TabDict` instances. "
"Then, the items therein can be fetched by `TabKey` instances.",
long_description_content_type="text/markdown",
url="https://github.com/SongminYu/tab2dict",
author="Songmin Yu",
Expand Down

0 comments on commit 8ab3d42

Please sign in to comment.