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.5.tar.gz
(16.4 kB
view details)
Built Distribution
coopio-1.5-py3-none-any.whl
(21.1 kB
view details)
File details
Details for the file coopio-1.5.tar.gz
.
File metadata
- Download URL: coopio-1.5.tar.gz
- Upload date:
- Size: 16.4 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 | 8c15a3dfe65c55e7538656802ffbfc715767e079ed72f65af2627650203211bc |
|
MD5 | 6e6ccee4ed1c714d11a72200dcfa95b9 |
|
BLAKE2b-256 | 79f86700b57e962357b0fafc392b09b99ef12639aa92f39ada4a66edb1bb823c |
File details
Details for the file coopio-1.5-py3-none-any.whl
.
File metadata
- Download URL: coopio-1.5-py3-none-any.whl
- Upload date:
- Size: 21.1 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 | e4357fda6b5d0cd2f71419026b99e72161303c397a67a2f3806ae5183043a2ea |
|
MD5 | da749b41065b36412acbc9d5e72c7ba6 |
|
BLAKE2b-256 | f5a6e3d1a243dcc8fd3084832fe29fd8226e3d27ce83f4ab1883a4f848e37fc2 |