-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
71 lines (56 loc) · 2.01 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import os
print("--------------- DaTa Insights --------------- \n")
print("This software is made by Varun Banka \n")
print("Loading......\n")
def mainApp(): # dont read this, read from line 43
parser = argparse.ArgumentParser()
parser.add_argument("input", help="Enter the name of csv file (without extension) : ")
args = parser.parse_args()
input_value = args.input
input_value = input_value + ".csv"
try:
df = pd.read_csv(input_value)
# code by Varun Banka
profile = ProfileReport(df, minimal=True)
profile.to_file(output_file="report.html")
except Exception as e:
# code by Varun Banka
print(f"Error: {e}")
def restart(): # this func is for restarting the software
restart = input("Would you like to restart? (y/n) ")
if restart == "y" or restart == "Y":
mainApp()
elif restart == "n":
exit()
else:
print("Thanks for using DataHive")
exit()
try:
import pandas as pd
from ydata_profiling import ProfileReport
import argparse
mainApp()
while (True):
restart()
except ImportError: # idk if the following code is required but i dont wanna remove it ffs
install_dependencies = input(
"Some dependencies aren't installed. Would you like to install them? (y/n) ")
if install_dependencies.lower() == "y":
try:
os.system("pip install pandas")
os.system("pip install ydata-profiling")
os.system("pip install argparse")
os.system("clear")
import pandas as pd
from ydata_profiling import ProfileReport
mainApp()
while (True):
restart()
except Exception as e:
print(f"Error: {e}")
input("Press any key to exit...")
exit()
else:
# code by Varun Banka
input("Apart from power key, press any key to exit...")
exit()