Spaces:
Runtime error
Runtime error
Update analytics.py
Browse files- analytics.py +15 -10
analytics.py
CHANGED
@@ -8,7 +8,6 @@ def write_to_csv_departments(time,teachingscore,teaching,courseContentscore,cour
|
|
8 |
libraryFacilities,extraCurricularscore,extraCurricular):
|
9 |
csv_file_path = 'dataset/database.csv'
|
10 |
df = pd.read_csv(csv_file_path)
|
11 |
-
header = df.columns.tolist()
|
12 |
|
13 |
# Creating a dictionary for the new row
|
14 |
new_row = {'Timestamp': time, 'teachingscore': teachingscore, 'teaching': teaching,
|
@@ -22,10 +21,13 @@ def write_to_csv_departments(time,teachingscore,teaching,courseContentscore,cour
|
|
22 |
new_data = pd.DataFrame(new_row, index=[0])
|
23 |
|
24 |
# Append the new data to the existing DataFrame
|
25 |
-
|
26 |
-
|
27 |
-
#
|
28 |
-
df.
|
|
|
|
|
|
|
29 |
|
30 |
|
31 |
|
@@ -46,11 +48,14 @@ def write_to_csv_teachers(teacher1,teacher1score,teacher2,teacher2score,teacher3
|
|
46 |
'teacher5': teacher5, 'teacher5score': teacher5score,
|
47 |
'teacher6': teacher6, 'teacher6score': teacher6score}
|
48 |
|
49 |
-
#
|
50 |
-
|
51 |
-
|
52 |
-
#
|
53 |
-
df.
|
|
|
|
|
|
|
54 |
|
55 |
|
56 |
def get_counts():
|
|
|
8 |
libraryFacilities,extraCurricularscore,extraCurricular):
|
9 |
csv_file_path = 'dataset/database.csv'
|
10 |
df = pd.read_csv(csv_file_path)
|
|
|
11 |
|
12 |
# Creating a dictionary for the new row
|
13 |
new_row = {'Timestamp': time, 'teachingscore': teachingscore, 'teaching': teaching,
|
|
|
21 |
new_data = pd.DataFrame(new_row, index=[0])
|
22 |
|
23 |
# Append the new data to the existing DataFrame
|
24 |
+
df2 = pd.concat([df, new_data], ignore_index=True)
|
25 |
+
|
26 |
+
# Append the new data to the existing DataFrame
|
27 |
+
# df = df.append(new_data, ignore_index=True)
|
28 |
+
# print(df2)
|
29 |
+
|
30 |
+
df2.to_csv(csv_file_path, mode='w', index=False)
|
31 |
|
32 |
|
33 |
|
|
|
48 |
'teacher5': teacher5, 'teacher5score': teacher5score,
|
49 |
'teacher6': teacher6, 'teacher6score': teacher6score}
|
50 |
|
51 |
+
# Concat the new row to the DataFrame
|
52 |
+
df2 = pd.concat([df, new_data], ignore_index=True)
|
53 |
+
|
54 |
+
# Append the new data to the existing DataFrame
|
55 |
+
# df = df.append(new_data, ignore_index=True)
|
56 |
+
# print(df2)
|
57 |
+
|
58 |
+
df2.to_csv(csv_file_path, mode='w', index=False)
|
59 |
|
60 |
|
61 |
def get_counts():
|