FDSRashid commited on
Commit
6da2368
·
verified ·
1 Parent(s): 58515bc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -79,8 +79,16 @@ def visualize_isnad(taraf_num, yaxis):
79
  G = nx.from_pandas_edgelist(isnad_hadith1, source = 'Source', target = 'Destination', create_using = nx.DiGraph())
80
  node = [int(n) for n, d in G.out_degree() if d == 0]
81
  for n in node:
82
- gen_node = narrator_bios[narrator_bios['Rawi ID']==n]['Generation'].iloc[0]
83
- name_node = narrator_bios[narrator_bios['Rawi ID']==n]['Famous Name'].iloc[0]
 
 
 
 
 
 
 
 
84
  lst_hadith.append([taraf_matns[i], gen_node, name_node, taraf_book[i], taraf_author[i], taraf_hadith_number[i], str(n), str(i)])
85
  df = pd.DataFrame(lst_hadith, columns = ['Matn', 'Generation', 'Name', 'Book_Name', 'Author', 'Book Hadith Number', 'End Transmitter ID', 'Hadith Number'])
86
 
 
79
  G = nx.from_pandas_edgelist(isnad_hadith1, source = 'Source', target = 'Destination', create_using = nx.DiGraph())
80
  node = [int(n) for n, d in G.out_degree() if d == 0]
81
  for n in node:
82
+ gen_node = narrator_bios[narrator_bios['Rawi ID']==n]['Generation'].to_list()
83
+ if len(gen_node):
84
+ gen_node = gen_node[0]
85
+ else:
86
+ gen_node = -1
87
+ name_node = narrator_bios[narrator_bios['Rawi ID']==n]['Famous Name'].to_list()
88
+ if len(name_node):
89
+ name_node = name_node[0]
90
+ else:
91
+ name_node = 'فلان'
92
  lst_hadith.append([taraf_matns[i], gen_node, name_node, taraf_book[i], taraf_author[i], taraf_hadith_number[i], str(n), str(i)])
93
  df = pd.DataFrame(lst_hadith, columns = ['Matn', 'Generation', 'Name', 'Book_Name', 'Author', 'Book Hadith Number', 'End Transmitter ID', 'Hadith Number'])
94