Skip to content

Commit

Permalink
only returning exact terms.
Browse files Browse the repository at this point in the history
  • Loading branch information
ypriverol committed Feb 28, 2024
1 parent 3649fc2 commit cd8bd10
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions sdrf_pipelines/sdrf/sdrf_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import re
import typing
from typing import Any

import numpy as np
import pandas as pd
from pandas_schema import Column
from pandas_schema import Schema
Expand Down Expand Up @@ -321,11 +323,11 @@ def validate_empty_cells(self, panda_sdrf):
"""
errors = []

def validate_string(string):
return len(string.strip()) > 0
def validate_string(cell_value):
return cell_value is not None and cell_value != "nan" and len(cell_value.strip()) > 0

# Apply the validation function element-wise
validation_results = panda_sdrf.map(lambda x: validate_string(x))
validation_results = panda_sdrf.map(validate_string)

# Get the indices where the validation fails
failed_indices = [(row, col) for row in validation_results.index for col in validation_results.columns if
Expand Down

0 comments on commit cd8bd10

Please sign in to comment.