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.8.tar.gz
(17.8 kB
view details)
Built Distribution
coopio-1.8-py3-none-any.whl
(23.4 kB
view details)
File details
Details for the file coopio-1.8.tar.gz
.
File metadata
- Download URL: coopio-1.8.tar.gz
- Upload date:
- Size: 17.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4eadf81d5376569c395e15c6a2c568a4c11b2034b54e9b197d8ec7cbd6a698f6 |
|
MD5 | 2fe342ce04dca485b21c72906e7168b5 |
|
BLAKE2b-256 | 1829b999075e756cec67e84e09d61d45ad98ec481be4fe9d6c49f3661c47033b |
File details
Details for the file coopio-1.8-py3-none-any.whl
.
File metadata
- Download URL: coopio-1.8-py3-none-any.whl
- Upload date:
- Size: 23.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 49d9a85d9858ff4aa5f729631fe386afb4fa523fd54d1cda1264d6c67bdda10d |
|
MD5 | 25e2b07f1af310211f6e5f18c54f4d48 |
|
BLAKE2b-256 | b2b1d22bf3303aceaec42a835cc3ca6d4083045f16f2cc1ed7a0071a2206e3ad |