FDSRashid commited on
Commit
ef641ab
·
verified ·
1 Parent(s): 42ab666

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -71,11 +71,13 @@ def visualize_isnad(taraf_num, yaxis):
71
  taraf_author = matn_info[matn_info['taraf_ID'] == taraf_num]['Author'].to_list()
72
  taraf_hadith_number = matn_info[matn_info['taraf_ID'] == taraf_num]['Hadith Number'].to_list()
73
  lst_hadith = []
 
 
74
  for i in range(len(taraf_hadith_split)):
75
  # This checks each hadith in the Taraf, is that book id hadith id found in each of the edges of isnad_info
76
  #This loop get the end transmitter of each Hadith in the Taraf
77
- isnad_in_hadith1 = isnad_info['Hadiths Cleaned'].apply(lambda x: taraf_hadith_split[i] in x )
78
- isnad_hadith1 = isnad_info[isnad_in_hadith1][['Source', 'Destination']]
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][0]
81
  gen_node = narrator_bios[narrator_bios['Rawi ID']==node]['Generation'].iloc[0]
@@ -84,8 +86,7 @@ def visualize_isnad(taraf_num, yaxis):
84
  df = pd.DataFrame(lst_hadith, columns = ['Matn', 'Generation', 'Name', 'Book_Name', 'Author', 'Book Hadith Number', 'End Transmitter ID', 'Hadith Number'])
85
 
86
  #hadith_cleaned = isnad_info['Hadiths Cleaned'].apply(lambda x: any(i in x for i in taraf_hadith_split) )
87
- hadith_cleaned = isnad_info['Tarafs Cleaned'].apply(lambda x: taraf_num in x)
88
- isnad_hadith = isnad_info[hadith_cleaned]
89
  isnad_hadith['Teacher'] = isnad_hadith['Source'].apply(lambda x: narrator_bios[narrator_bios['Rawi ID'].astype(int) == int(x)]['Famous Name'].to_list())
90
  isnad_hadith['Student'] = isnad_hadith['Destination'].apply(lambda x: narrator_bios[narrator_bios['Rawi ID'].astype(int) == int(x)]['Famous Name'].to_list())
91
  isnad_hadith['Teacher'] = isnad_hadith['Teacher'].apply(lambda x: x[0] if len(x)==1 else 'فلان')
 
71
  taraf_author = matn_info[matn_info['taraf_ID'] == taraf_num]['Author'].to_list()
72
  taraf_hadith_number = matn_info[matn_info['taraf_ID'] == taraf_num]['Hadith Number'].to_list()
73
  lst_hadith = []
74
+ hadith_cleaned = isnad_info['Tarafs Cleaned'].apply(lambda x: taraf_num in x)
75
+ isnad_hadith = isnad_info[hadith_cleaned]
76
  for i in range(len(taraf_hadith_split)):
77
  # This checks each hadith in the Taraf, is that book id hadith id found in each of the edges of isnad_info
78
  #This loop get the end transmitter of each Hadith in the Taraf
79
+ isnad_in_hadith1 = isnad_hadith['Hadiths Cleaned'].apply(lambda x: taraf_hadith_split[i] in x )
80
+ isnad_hadith1 = isnad_hadith[isnad_in_hadith1][['Source', 'Destination']]
81
  G = nx.from_pandas_edgelist(isnad_hadith1, source = 'Source', target = 'Destination', create_using = nx.DiGraph())
82
  node = [int(n) for n, d in G.out_degree() if d == 0][0]
83
  gen_node = narrator_bios[narrator_bios['Rawi ID']==node]['Generation'].iloc[0]
 
86
  df = pd.DataFrame(lst_hadith, columns = ['Matn', 'Generation', 'Name', 'Book_Name', 'Author', 'Book Hadith Number', 'End Transmitter ID', 'Hadith Number'])
87
 
88
  #hadith_cleaned = isnad_info['Hadiths Cleaned'].apply(lambda x: any(i in x for i in taraf_hadith_split) )
89
+
 
90
  isnad_hadith['Teacher'] = isnad_hadith['Source'].apply(lambda x: narrator_bios[narrator_bios['Rawi ID'].astype(int) == int(x)]['Famous Name'].to_list())
91
  isnad_hadith['Student'] = isnad_hadith['Destination'].apply(lambda x: narrator_bios[narrator_bios['Rawi ID'].astype(int) == int(x)]['Famous Name'].to_list())
92
  isnad_hadith['Teacher'] = isnad_hadith['Teacher'].apply(lambda x: x[0] if len(x)==1 else 'فلان')