Skip to content
Merged

Dev1 #10

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/.conf/plot_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"global_style": {
"style": "whitegrid",
"context": "talk",
"figure.figsize": [12, 8],
"axes.titlesize": 20,
"axes.labelsize": 18
},
"boxplot": {
"palette": "viridis"
},
"scatterplot": {
"style": "darkgrid"
},
"heatmap": {
"cmap": "coolwarm"
}
}
81 changes: 81 additions & 0 deletions src/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,83 @@
# __init__.py

# MIT License
#
# Copyright (c) 2023 Thaddeus Thomas
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

# Metadata about the package
__version__ = '1.1.1'
__author__ = 'Thaddeus Thomas'
__email__ = 'thaddeus@vcwtech.com'

import logging
import sys

# Convenience imports for users
from .data_analysis_toolkit import DataAnalysisToolkit
from .utils import DataImputer
from .model import FeatureEngineer, ModelEvaluator
from .preprocessor import DataPreprocessor
from .generators import ReportGenerator
from .visualizer import DataVisualizer

# Dependency checks
required_packages = {
'pandas': '1.1.5',
'matplotlib': '3.3.4',
'scipy': '1.6.0',
'sklearn': '0.24.1'
}

missing_packages = []

for lib, version in required_packages.items():
try:
pkg = __import__(lib)
if pkg.__version__ < version:
missing_packages.append(f"{lib}>= {version}")
except ImportError:
missing_packages.append(f"{lib}>= {version}")

if missing_packages:
sys.exit("Missing required packages: " + ', '.join(missing_packages))

# Configure logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)

logger.info("Initializing DataAnalysisToolkit package")

# Initialization code that runs on package import, if any
def _init_package():
# Put any package-wide initialization logic here
logger.debug("Package initialized successfully")

_init_package()

# Ensure that this module only exposes the intended public interface
__all__ = [
"DataAnalysisToolkit",
"DataImputer",
"DataVisualizer",
"FeatureEngineer",
"ModelEvaluator",
"DataPreprocessor",
"ReportGenerator"
]
21 changes: 0 additions & 21 deletions src/data_analysis_toolkit.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,3 @@
# MIT License
#
# Copyright (c) 2023 Thaddeus Thomas
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

"""data_analysis_toolkit.py

This module contains a class, DataAnalysisToolkit, for performing various data
Expand Down
2 changes: 1 addition & 1 deletion src/data_sources/api_connector.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""api_connector.py
"""data_sources/api_connector.py
_summary_

_extended_summary_
Expand Down
14 changes: 8 additions & 6 deletions src/data_sources/excel_connector.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""excel_connector.py
"""data_sources/excel_connector.py
_summary_

_extended_summary_
Expand Down Expand Up @@ -40,8 +40,10 @@ def load_data(self, sheet_name=0, header=0):
Load data from a specified sheet in the Excel file.

Args:
sheet_name (str or int, optional): The name or index of the sheet to read data from. Defaults to the first sheet.
header (int, list of int, optional): Row (0-indexed) to use as the header.
sheet_name (str or int, optional): The name or index of the sheet
to read data from. Defaults to the first sheet.
header (int, list of int, optional): Row (0-indexed) to use as the
header.

Returns:
DataFrame: A pandas DataFrame containing the data from the Excel
Expand All @@ -52,7 +54,7 @@ def load_data(self, sheet_name=0, header=0):
try:
return pd.read_excel(self.file_path, sheet_name=sheet_name, header=header)
except Exception as e:
raise Exception(f"Error reading Excel file: {e}")
raise Exception(f"Error reading Excel file: {e}") from e

def load_all_sheets(self):
"""
Expand All @@ -66,7 +68,7 @@ def load_all_sheets(self):
try:
return pd.read_excel(self.file_path, sheet_name=None)
except Exception as e:
raise Exception(f"Error reading Excel file: {e}")
raise Exception(f"Error reading Excel file: {e}") from e

def preview_sheet(self, sheet_name=0, num_rows=5):
"""
Expand All @@ -86,4 +88,4 @@ def preview_sheet(self, sheet_name=0, num_rows=5):
try:
return pd.read_excel(self.file_path, sheet_name=sheet_name, nrows=num_rows)
except Exception as e:
raise Exception(f"Error previewing Excel file: {e}")
raise Exception(f"Error previewing Excel file: {e}") from e
Loading