data/feature_extraction.py
def compute_nonzero_avg(lst: str) -> float:
        """Computes the average of nonzero elements in the list.

        Args:
            lst: A str of list representation.

        Returns: A integer indicating the average of nonzero elements
            in the list.
        """
        if pd.isna(lst):
            return 0.0
        lst = eval(lst)
        total = 0
        count = 0
        for e in lst:
            if e != 0:
                total += e
                count += 1
        if count == 0:
            return 0.0
        return total / count
Computes the average of nonzero elements in the list.

        Args:
            lst: A str of list representation.

        Returns: A integer indicating the average of nonzero elements
            in the list.
        
Computes the average of nonzero elements in the list.
Computes the average of nonzero elements in the list .
def compute_nonzero_avg(lst: str) -> float:
        if pd.isna(lst):
            return 0.0
        lst = eval(lst)
        total = 0
        count = 0
        for e in lst:
            if e != 0:
                total += e
                count += 1
        if count == 0:
            return 0.0
        return total / count
def compute_nonzero_avg ( lst : str ) -> float : if pd . isna ( lst ) : return 0.0 lst = eval ( lst ) total = 0 count = 0 for e in lst : if e != 0 : total += e count += 1 if count == 0 : return 0.0 return total / count
Computes the average of nonzero elements in the list.
Computes the average of nonzero elements in the list .
"""Computes the average of nonzero elements in the list.

        Args:
            lst: A str of list representation.

        Returns: A integer indicating the average of nonzero elements
            in the list.
        """
lst
str
A str of list representation.
A str of list representation .