pass with open(file_path, 'r+') as f: lines = f.readlines() lines = [line.strip() for line in lines] # 書き込もうとしている特徴量がすでに書き込まれていないかチェック col = [line for line in lines if line.split(',')[0] == col_name] if len(col) != 0: return writer = csv.writer(f) writer.writerow([col_name, desc]) if __name__ == '__main__': # CSVのヘッダーを書き込み create_memo('特徴量', 'メモ') args = get_arguments() train = pd.read_csv(RAW_DATA_DIR_NAME + 'train.csv') test = pd.read_csv(RAW_DATA_DIR_NAME + 'test.csv') # globals()でtrain,testのdictionaryを渡す generate_features(globals(), args.force) # 特徴量メモをソートする feature_df = pd.read_csv(feature_memo_path) feature_df = feature_df.sort_values('特徴量') feature_df.to_csv(feature_memo_path, index=False)
new_module = install_update_module('clv_tag', update, True) new_module = install_update_module('clv_tag_cst', update) new_module = install_update_module('clv_annotation', update, True) new_module = install_update_module('clv_annotation_cst', update) new_module = install_update_module('clv_address', update, True) new_module = install_update_module('clv_address_cst', update) def secondsToStr(t): return "%d:%02d:%02d.%03d" % reduce(lambda ll,b : divmod(ll[0],b) + ll[1:],[(t*1000,),1000,60,60]) if __name__ == '__main__': from time import time start = time() base.get_arguments() print '--> Executing clvhealth_install.py...' print '--> Executing clvhealth_install()...' clvhealth_install() print '--> clvhealth_install.py' print '--> Execution time:', secondsToStr(time() - start)
install_update_module('l10n_br_clv_abcfarma_medicament', update, True) install_update_module('l10n_br_clv_orz_medicament', update, True) install_update_module('l10n_br_clv_grm_medicament', update, True) install_update_module('clv_todo', update) def secondsToStr(t): return "%d:%02d:%02d.%03d" % \ reduce(lambda ll, b: divmod(ll[0], b) + ll[1:], [(t * 1000,), 1000, 60, 60]) if __name__ == '__main__': from time import time base.get_arguments() start = time() print '--> Executing mostlyopen_install.py...' print '--> Executing mostlyopen_install()...' mostlyopen_install() print '--> mostlyopen_install.py' print '--> Execution time:', secondsToStr(time() - start)
if len(col) != 0: return writer = csv.writer(f) writer.writerow([col_name, desc]) if __name__ == '__main__': # CSVのヘッダーを書き込み create_memo('特徴量', 'メモ') if 'ipykernel' in sys.modules: # pklファイルを上書きする際はTrueに書き換え overwrite_ok = True else: overwrite_ok = get_arguments().force train = pd.read_csv(RAW_DATA_DIR_NAME + 'train.csv') test = pd.read_csv(RAW_DATA_DIR_NAME + 'test.csv') # globals()でtrain,testのdictionaryを渡す generate_features(globals(), overwrite_ok) # 特徴量メモをソートする feature_df = pd.read_csv(feature_memo_path) feature_df = feature_df.sort_values('特徴量') feature_df.to_csv(feature_memo_path, index=False) # %%