-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Organize repo, create tests, add CI support
- Loading branch information
1 parent
5908cff
commit 9373fd9
Showing
20 changed files
with
85 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Run Pytest on Push | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 # Checks out your repository code | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
|
||
# Specify your Python version here | ||
with: | ||
python-version: "3.10.10" | ||
|
||
# Install all modules used in code | ||
- name: Install Dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
# Run your pytest tests | ||
- name: Run Pytest | ||
run: | | ||
pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# PYTHON VERSION: 3.10.10 | ||
|
||
numpy==1.24.2 | ||
pytest==7.4.2 | ||
pandas==2.0.0 | ||
|
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import pandas as pd | ||
|
||
|
||
def preprocess_df(file_path: str) -> pd.DataFrame: | ||
df = pd.read_csv(file_path) | ||
relevant_features = [ | ||
"Email Address", | ||
"Name", | ||
"Castlemont", | ||
"Montera", | ||
"DeJean", | ||
"DCA", | ||
"Rudsdale", | ||
"Longfellow", | ||
"SquashDrive", | ||
"John Henry", | ||
"Life Academy", | ||
"CC Member", | ||
"Exec", | ||
"Spanish Speaker", | ||
"Can Drive", | ||
"Has Car", | ||
"Gender", | ||
"Site Leader", | ||
] | ||
# Select columns that contain a feature | ||
relevant_columns = [ | ||
col | ||
for col in df.columns | ||
if any(feature in col for feature in relevant_features) | ||
] | ||
|
||
# Create a new DataFrame with only the relevant columns | ||
pre_processed_df = df[relevant_columns] | ||
|
||
return pre_processed_df |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
Binary file not shown.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import pytest | ||
import pandas as pd | ||
|
||
from site_slotting_new import algorithm | ||
from site_slotting_new import data_cleaning | ||
|
||
|
||
def test_preprocess_df1(): | ||
file = "data/anonymized_spring24_sites_data.csv" | ||
cleaned_data = data_cleaning.preprocess_df(file) | ||
print(cleaned_data.columns) | ||
assert cleaned_data.shape[1] <= 18 | ||
|
||
|
||
def test_preprocess_df2(): | ||
file = "data/anonymized_spring24_sites_data.csv" | ||
cleaned_data = data_cleaning.preprocess_df(file) | ||
assert cleaned_data.shape[1] == 18 |
File renamed without changes.