forked from Data-Centric-AI-Community/ydata-profiling
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprofile_csv.py
More file actions
21 lines (15 loc) · 767 Bytes
/
profile_csv.py
File metadata and controls
21 lines (15 loc) · 767 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import pandas as pd
import pandas_profiling
if __name__ == "__main__":
import argparse
import webbrowser
parser = argparse.ArgumentParser(description='Profile the variables in a CSV file and generate a HTML report.')
parser.add_argument("inputfile", help="CSV file to profile")
parser.add_argument("-o", "--output", help="Output report file", default=pandas_profiling.DEFAULT_OUTPUTFILE)
parser.add_argument("-s", "--silent", help="Only generate but do not open report", action="store_true")
args = parser.parse_args()
df = pd.read_csv(args.inputfile, sep=None, parse_dates=True)
p = pandas_profiling.ProfileReport(df)
p.to_file(outputfile=args.output)
if not args.silent:
webbrowser.open_new_tab(p.file.name)