Created
October 18, 2019 20:50
-
-
Save ShaiberAlon/8ebd5fb43308086d5455bea18bbdefee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import argparse | |
import pandas as pd | |
parser = argparse.ArgumentParser(description='Find the items that occur in all rows of a table (i.e. rows in which all values are greater than 0) and save to output file.') | |
parser.add_argument('-i', '--input', help='Input file.') | |
parser.add_argument('-o', '--output', help='Output file.') | |
args = parser.parse_args() | |
d = pd.read_csv(args.input, sep='\t', index_col=0) | |
d = d.applymap(lambda x: 1 if x>0 else 0) | |
d.to_csv(args.output, sep='\t') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment