Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

from typing import List

def labeling(df:pd.DataFrame, columns_name:list) -> pd.DataFrame:
    data = df.copy()
    for column in columns_name:
        for i in range(len(data[column])):
            if data[column][i] > 0:
                data[column] = data[column].replace(data[column][i], 1)
            else:
                data[column] = data[column].replace(data[column][i], 0)
    return data
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #typing #import #List
ADD COMMENT
Topic
Name
7+3 =