Created
October 4, 2021 00:46
-
-
Save thomashikaru/2d9083d699c66f41fad4c1d76241c15c 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
import argparse | |
import pandas as pd | |
if __name__ == "__main__": | |
# create argument parser and define arguments | |
parser = argparse.ArgumentParser() | |
parser.add_argument("--inputfile", default="inputfile.csv") | |
parser.add_argument("--num_rows", type=int, default=10) | |
parser.add_argument("--print_output", action="store_true") | |
args = parser.parse_args() | |
# read in dataset | |
df = pd.read_csv(args.inputfile) | |
df_subset = df.iloc[:args.num_rows, :] | |
# print dataset if flag is set | |
if args.print_output: | |
print(df_subset) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment