Mercurial > repos > jay > pdaug_merge_dataframes
view PDAUG_AddClassLabel/PDAUG_AddClassLabel.py @ 1:fcd5d259427c draft
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit 3c91f421d26c8f42cf2671e47db735d2cf69dde8"
author | jay |
---|---|
date | Tue, 29 Dec 2020 04:05:22 +0000 |
parents | 5bb52d4bf172 |
children |
line wrap: on
line source
import pandas as pd import argparse parser = argparse.ArgumentParser() parser.add_argument("-I", "--InFile", required=True, default=None, help="Input data file") parser.add_argument("-C", "--ClassLabel", required=False, default=0, help="Class Label 0 or 1") parser.add_argument("-t", "--ClassLabelTitle", required=False, default='Class_label', help="Title to use for class label column (Class_label)") parser.add_argument("-O", "--OutFile", required=False, default='OutFile.tsv', help="Output file name") args = parser.parse_args() df1 = pd.read_csv(args.InFile, sep="\t") df2 = pd.DataFrame([args.ClassLabel]*df1.shape[0], columns=[args.ClassLabelTitle]) df = pd.concat([df1, df2], axis=1) df.to_csv(args.OutFile, sep="\t", index=False)