Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -242,7 +242,7 @@ def main():
|
|
242 |
|
243 |
df_final1 = df_final[df_final['Component'].str.split().str.len().gt(1)]
|
244 |
#st.write(df_final[df_final['Component'].str.len() != 1])
|
245 |
-
df_final1.to_csv('predictions.csv')
|
246 |
|
247 |
# buffer = io.BytesIO()
|
248 |
# with pd.ExcelWriter(buffer, engine="xlsxwriter") as writer:
|
@@ -479,7 +479,7 @@ def main():
|
|
479 |
# 'Society': [count_soc_np, count_soc_investor, count_soc_customer, count_soc_employee, count_soc_society]},
|
480 |
# index=['Non-performance', 'Investors', 'Customers', 'Employees', 'Society'])
|
481 |
|
482 |
-
df_tab.to_csv('final_data.csv')
|
483 |
|
484 |
buffer = io.BytesIO()
|
485 |
with pd.ExcelWriter(buffer, engine="xlsxwriter") as writer:
|
@@ -489,18 +489,18 @@ def main():
|
|
489 |
df = pd.read_csv('final_data.csv', index_col=0)
|
490 |
#474-515
|
491 |
# # Convert to JSON format
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
#
|
502 |
-
|
503 |
-
|
504 |
# # repo.git_pull()
|
505 |
# # repo.git_add("ch.json")
|
506 |
# # repo.git_commit(commit_message="add ch.json :)")
|
|
|
242 |
|
243 |
df_final1 = df_final[df_final['Component'].str.split().str.len().gt(1)]
|
244 |
#st.write(df_final[df_final['Component'].str.len() != 1])
|
245 |
+
#df_final1.to_csv('predictions.csv')
|
246 |
|
247 |
# buffer = io.BytesIO()
|
248 |
# with pd.ExcelWriter(buffer, engine="xlsxwriter") as writer:
|
|
|
479 |
# 'Society': [count_soc_np, count_soc_investor, count_soc_customer, count_soc_employee, count_soc_society]},
|
480 |
# index=['Non-performance', 'Investors', 'Customers', 'Employees', 'Society'])
|
481 |
|
482 |
+
#df_tab.to_csv('final_data.csv')
|
483 |
|
484 |
buffer = io.BytesIO()
|
485 |
with pd.ExcelWriter(buffer, engine="xlsxwriter") as writer:
|
|
|
489 |
df = pd.read_csv('final_data.csv', index_col=0)
|
490 |
#474-515
|
491 |
# # Convert to JSON format
|
492 |
+
json_data = []
|
493 |
+
for row in df_tab.index:
|
494 |
+
for col in df_tab.columns:
|
495 |
+
json_data.append({
|
496 |
+
'source': row,
|
497 |
+
'target': col,
|
498 |
+
'value': int(df.loc[row, col])
|
499 |
+
})
|
500 |
+
|
501 |
+
# Write JSON to file
|
502 |
+
with open('ch.json', 'w+') as f:
|
503 |
+
json.dump(json_data, f)
|
504 |
# # repo.git_pull()
|
505 |
# # repo.git_add("ch.json")
|
506 |
# # repo.git_commit(commit_message="add ch.json :)")
|