Skip to content

Commit

Permalink
use pandas map to simplify code plus some maintenance
Browse files Browse the repository at this point in the history
🎨 applymap is depreceated since pandas 2.1
  • Loading branch information
fabianegli authored Jan 20, 2025
2 parents 97256a5 + 1b33af2 commit 7eb463e
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 38 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ jobs:
PythonBlack:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

# Set up the specific Python version for Black
- name: Set up Python 3.12
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: 3.12 # Set your desired Python version here
python-version: "3.12" # Set your desired Python version here

# Install Black and dependencies if necessary
- name: Install Black
Expand Down Expand Up @@ -52,26 +52,26 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out source-code repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Python 3.8
uses: actions/setup-python@v2
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: "3.10"
- name: python-isort
uses: isort/isort-action@v0.1.0
uses: isort/isort-action@v1
with:
isortVersion: "latest"
requirementsFiles: "requirements.txt requirements-dev.txt"

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v1
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/conda-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Miniconda
uses: conda-incubator/setup-miniconda@v2
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: 3.9
python-version: '3.10'
channels: conda-forge,defaults,bioconda

- name: Create conda environment
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/pythonapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v1
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10"]

python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pythonpublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
Expand Down
6 changes: 3 additions & 3 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ channels:
- bioconda
- defaults
dependencies:
- python=3.8
- python=3.10
- conda-build
- anaconda-client
- pandas
- pandas>=2.1
- click
- requests
- pyyaml
Expand All @@ -17,4 +17,4 @@ dependencies:
- python-duckdb
- rdflib
- pandas_schema

- setuptools
7 changes: 4 additions & 3 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,21 @@ build:
requirements:
host:
- pip
- python >=3.5
- python >=3.10
- setuptools
run:
- click
- requests
- pandas
- pandas_schema
- python >=3.5
- python >=3.10
- pyaml
- defusedxml
- pytest
- duckdb
- rdflib
- pyarrow
- setuptools

test:
imports:
Expand All @@ -47,4 +48,4 @@ about:
##license_file: LICENSE ## patch is applied upstream, next version will have it
summary: "Translate, convert SDRF to configuration pipelines"
doc_url: "https://github.com/bigbio/sdrf-pipelines"
dev_url: "https://github.com/bigbio/sdrf-pipelines"
dev_url: "https://github.com/bigbio/sdrf-pipelines"
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pandas
pandas>2.1
click
# https://github.com/multimeric/PandasSchema does not seem to be maintained
# anymore, and right now it thows a pandas deprecation warning, in the
Expand All @@ -12,4 +12,4 @@ defusedxml
pyarrow
duckdb
rdflib
setuptools
setuptools
7 changes: 1 addition & 6 deletions sdrf_pipelines/sdrf/sdrf_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,12 +361,7 @@ def validate_empty_cells(self, panda_sdrf):
def validate_string(cell_value):
return cell_value is not None and cell_value != "nan" and len(cell_value.strip()) > 0

if sys.version_info <= (3, 8):
# Use map for Python versions less than 3.8
validation_results = panda_sdrf.map(validate_string)
else:
# Use applymap for Python versions 3.8 and above
validation_results = panda_sdrf.applymap(validate_string)
validation_results = panda_sdrf.map(validate_string)

# Get the indices where the validation fails
failed_indices = [
Expand Down

0 comments on commit 7eb463e

Please sign in to comment.