コード例 #1
0
 def one_hot(self, data_set, column_tag):
     df = DataFrame()
     df.data_set = data_set
     data_list = df.get_all_values().tolist()
     dumies = self.dumies_tags(df, column_tag)
     dumies = self.biuld_dumies(data_list, dumies)
     return pd.DataFrame(dumies)
コード例 #2
0
    def one_hot2(self, data_set, column_tag):
        df = DataFrame()
        df.data_set = data_set
        data_list = df.get_all_values().tolist()
        dumies = self.dumies_tags_index(df, column_tag)

        for i in range(len(data_list)):
            data_list[i] = dumies[data_list[i][0]]

        dic = {str(column_tag): data_list}
        data = pd.DataFrame(dic)
        return data