Library for creating data services
Project description
coopio
Library for creating data services
CsvDataService Example:
class Dummy:
def __init__(self, a, b, c):
self.a = a
self.b = b
self.c = c
def __str__(self):
return f"a: {self.a}, b: {self.b}, c: {self.c}"
def __repr__(self):
return self.__str__()
class CsvDataService_Dummy(ICsvDataService):
def __init__(self, data_file_path: str):
ICsvDataService.__init__(self, data_file_path)
def translate_from_data_rows(self, df: pd.DataFrame) -> List[T]:
ret_dummies = []
for i, row in df.iterrows():
new_dummy = Dummy(
a=row['a'],
b=row['b'],
c=row['c']
)
ret_dummies.append(new_dummy)
return ret_dummies
After Establishing the data service, data can be stored or retrieved as follows:
dummies = []
for ii in range(0, 5):
dummies.append(Dummy(ii, 2, 3))
data_service.add_or_update(obj_identifier='a', objs=dummies)
stored = data_service.retrieve_data(obj_identifier='a')
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
coopio-1.2.tar.gz
(14.2 kB
view details)
Built Distribution
coopio-1.2-py3-none-any.whl
(19.9 kB
view details)
File details
Details for the file coopio-1.2.tar.gz
.
File metadata
- Download URL: coopio-1.2.tar.gz
- Upload date:
- Size: 14.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb30d4bb25123592952aece29dbd8d4fac73d42eca0f654fc8123553b8ae8701 |
|
MD5 | 66aab00679c622ab9cb22bad76f13fda |
|
BLAKE2b-256 | 2a2ed361152e90e44d2820e25fa8fbb4745aa4ecb040735fbeaceaafd0af3cf3 |
File details
Details for the file coopio-1.2-py3-none-any.whl
.
File metadata
- Download URL: coopio-1.2-py3-none-any.whl
- Upload date:
- Size: 19.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe07489d8784561d34e87a6b095ad912f7eda563738b272504639aba7bebe5cf |
|
MD5 | 328ed60c97234c843d7fef6769842ea7 |
|
BLAKE2b-256 | ea0da012e43223b675ce42e2d9e09f2972e00853ca8044e7b636d5528338050e |