ecodev-core 0.0.23__tar.gz → 0.0.25__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of ecodev-core might be problematic. Click here for more details.
- {ecodev_core-0.0.23 → ecodev_core-0.0.25}/PKG-INFO +1 -1
- {ecodev_core-0.0.23 → ecodev_core-0.0.25}/ecodev_core/__init__.py +5 -1
- {ecodev_core-0.0.23 → ecodev_core-0.0.25}/ecodev_core/pandas_utils.py +29 -0
- {ecodev_core-0.0.23 → ecodev_core-0.0.25}/pyproject.toml +1 -1
- {ecodev_core-0.0.23 → ecodev_core-0.0.25}/LICENSE.md +0 -0
- {ecodev_core-0.0.23 → ecodev_core-0.0.25}/README.md +0 -0
- {ecodev_core-0.0.23 → ecodev_core-0.0.25}/ecodev_core/app_activity.py +0 -0
- {ecodev_core-0.0.23 → ecodev_core-0.0.25}/ecodev_core/app_rights.py +0 -0
- {ecodev_core-0.0.23 → ecodev_core-0.0.25}/ecodev_core/app_user.py +0 -0
- {ecodev_core-0.0.23 → ecodev_core-0.0.25}/ecodev_core/auth_configuration.py +0 -0
- {ecodev_core-0.0.23 → ecodev_core-0.0.25}/ecodev_core/authentication.py +0 -0
- {ecodev_core-0.0.23 → ecodev_core-0.0.25}/ecodev_core/backup.py +0 -0
- {ecodev_core-0.0.23 → ecodev_core-0.0.25}/ecodev_core/check_dependencies.py +0 -0
- {ecodev_core-0.0.23 → ecodev_core-0.0.25}/ecodev_core/custom_equal.py +0 -0
- {ecodev_core-0.0.23 → ecodev_core-0.0.25}/ecodev_core/db_connection.py +0 -0
- {ecodev_core-0.0.23 → ecodev_core-0.0.25}/ecodev_core/db_filters.py +0 -0
- {ecodev_core-0.0.23 → ecodev_core-0.0.25}/ecodev_core/db_insertion.py +0 -0
- {ecodev_core-0.0.23 → ecodev_core-0.0.25}/ecodev_core/db_retrieval.py +0 -0
- {ecodev_core-0.0.23 → ecodev_core-0.0.25}/ecodev_core/enum_utils.py +0 -0
- {ecodev_core-0.0.23 → ecodev_core-0.0.25}/ecodev_core/list_utils.py +0 -0
- {ecodev_core-0.0.23 → ecodev_core-0.0.25}/ecodev_core/logger.py +0 -0
- {ecodev_core-0.0.23 → ecodev_core-0.0.25}/ecodev_core/permissions.py +0 -0
- {ecodev_core-0.0.23 → ecodev_core-0.0.25}/ecodev_core/pydantic_utils.py +0 -0
- {ecodev_core-0.0.23 → ecodev_core-0.0.25}/ecodev_core/read_write.py +0 -0
- {ecodev_core-0.0.23 → ecodev_core-0.0.25}/ecodev_core/safe_utils.py +0 -0
|
@@ -50,8 +50,11 @@ from ecodev_core.list_utils import lselectfirst
|
|
|
50
50
|
from ecodev_core.logger import log_critical
|
|
51
51
|
from ecodev_core.logger import logger_get
|
|
52
52
|
from ecodev_core.pandas_utils import get_excelfile
|
|
53
|
+
from ecodev_core.pandas_utils import get_value
|
|
54
|
+
from ecodev_core.pandas_utils import is_null
|
|
53
55
|
from ecodev_core.pandas_utils import jsonify_series
|
|
54
56
|
from ecodev_core.pandas_utils import pd_equals
|
|
57
|
+
from ecodev_core.pandas_utils import safe_drop_columns
|
|
55
58
|
from ecodev_core.permissions import Permission
|
|
56
59
|
from ecodev_core.pydantic_utils import Basic
|
|
57
60
|
from ecodev_core.pydantic_utils import CustomFrozen
|
|
@@ -68,6 +71,7 @@ from ecodev_core.safe_utils import safe_clt
|
|
|
68
71
|
from ecodev_core.safe_utils import SafeTestCase
|
|
69
72
|
from ecodev_core.safe_utils import SimpleReturn
|
|
70
73
|
from ecodev_core.safe_utils import stringify
|
|
74
|
+
|
|
71
75
|
__all__ = [
|
|
72
76
|
'AUTH', 'Token', 'get_app_services', 'attempt_to_log', 'get_current_user', 'is_admin_user',
|
|
73
77
|
'write_json_file', 'load_json_file', 'make_dir', 'check_dependencies', 'compute_dependencies',
|
|
@@ -80,4 +84,4 @@ __all__ = [
|
|
|
80
84
|
'generic_insertion', 'custom_equal', 'is_authorized_user', 'get_method', 'AppActivity',
|
|
81
85
|
'fastapi_monitor', 'dash_monitor', 'is_monitoring_user', 'get_recent_activities', 'select_user',
|
|
82
86
|
'get_access_token', 'safe_get_user', 'backup', 'group_by', 'get_excelfile', 'upsert_new_user',
|
|
83
|
-
'datify']
|
|
87
|
+
'datify', 'safe_drop_columns', 'get_value', 'is_null']
|
|
@@ -4,7 +4,10 @@ Module implementing some utilitary methods on pandas types
|
|
|
4
4
|
import tempfile
|
|
5
5
|
from base64 import b64decode
|
|
6
6
|
from pathlib import Path
|
|
7
|
+
from typing import Any
|
|
8
|
+
from typing import Callable
|
|
7
9
|
from typing import Dict
|
|
10
|
+
from typing import Optional
|
|
8
11
|
|
|
9
12
|
import numpy as np
|
|
10
13
|
import pandas as pd
|
|
@@ -38,3 +41,29 @@ def get_excelfile(contents: str) -> pd.ExcelFile:
|
|
|
38
41
|
content_type, content_string = contents.split(',')
|
|
39
42
|
xl = b64decode(content_string)
|
|
40
43
|
return pd.ExcelFile(xl)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def safe_drop_columns(df: pd.DataFrame, columns: list[str]) -> pd.DataFrame:
|
|
47
|
+
"""
|
|
48
|
+
Returns a DataFrame without a list of columns, with a prior check on the existence of these
|
|
49
|
+
columns in the DataFrame
|
|
50
|
+
"""
|
|
51
|
+
|
|
52
|
+
return df.drop(columns=[col for col in columns if col in df.columns])
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def is_null(value: Any) -> bool:
|
|
56
|
+
"""
|
|
57
|
+
Checks if a value is null or not
|
|
58
|
+
"""
|
|
59
|
+
return value is None or isinstance(value, float) and np.isnan(value)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def get_value(column: str, method: Callable, row: pd.Series) -> Optional[Any]:
|
|
63
|
+
"""
|
|
64
|
+
Function which performs a method on a value if the column name is in the row index
|
|
65
|
+
"""
|
|
66
|
+
if column not in row.index or is_null(row[column]):
|
|
67
|
+
return None
|
|
68
|
+
|
|
69
|
+
return method(row[column])
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|