Spaces:
Sleeping
Sleeping
bug with numpy reshaping
Browse files
app.py
CHANGED
@@ -221,7 +221,10 @@ def visualize_subTaraf(taraf_num, hadith_str, yaxis):
|
|
221 |
sub_taraf = taraf[taraf['Index'].isin(hadiths)]
|
222 |
|
223 |
taraf_hadith = sub_taraf['bookid_hadithid'].to_list()
|
224 |
-
|
|
|
|
|
|
|
225 |
isnad_hadith[['Source', 'Destination']] = isnad_hadith[['Source', 'Destination']].astype(int)
|
226 |
|
227 |
# Merge isnad_hadith with narrator_bios for Teacher and Student
|
@@ -266,7 +269,10 @@ def visualize_hadith_isnad(df, yaxis):
|
|
266 |
df['bookid_hadithid'] = df['Book_ID'].astype(str) + '_' + df['Hadith Number'].astype(str)
|
267 |
hadith = matn_info[matn_info['bookid_hadithid'].isin(df['bookid_hadithid'])]
|
268 |
taraf_hadith = df['bookid_hadithid'].to_list()
|
269 |
-
|
|
|
|
|
|
|
270 |
isnad_hadith[['Source', 'Destination']] = isnad_hadith[['Source', 'Destination']].astype(int)
|
271 |
|
272 |
# Merge isnad_hadith with narrator_bios for Teacher and Student
|
@@ -332,8 +338,10 @@ def visualize_narrator_taraf(taraf_num, narrator, yaxis):
|
|
332 |
end_node.setdefault(node, []).append(str(idx))
|
333 |
|
334 |
# Update the graph
|
335 |
-
|
336 |
-
|
|
|
|
|
337 |
G = nx.from_pandas_edgelist(isnad_hadith, source = 'Source', target = 'Destination', create_using = nx.DiGraph())
|
338 |
isnad_pos = nx.nx_agraph.graphviz_layout(G, prog='dot')
|
339 |
|
|
|
221 |
sub_taraf = taraf[taraf['Index'].isin(hadiths)]
|
222 |
|
223 |
taraf_hadith = sub_taraf['bookid_hadithid'].to_list()
|
224 |
+
list_of_lists = [hadith_lookup[i] for i in taraf_hadith]
|
225 |
+
flattened = list(set([elem for sublist in list_of_lists for elem in sublist]))
|
226 |
+
|
227 |
+
isnad_hadith = isnad_info.iloc[flattened][['Source', 'Destination']]
|
228 |
isnad_hadith[['Source', 'Destination']] = isnad_hadith[['Source', 'Destination']].astype(int)
|
229 |
|
230 |
# Merge isnad_hadith with narrator_bios for Teacher and Student
|
|
|
269 |
df['bookid_hadithid'] = df['Book_ID'].astype(str) + '_' + df['Hadith Number'].astype(str)
|
270 |
hadith = matn_info[matn_info['bookid_hadithid'].isin(df['bookid_hadithid'])]
|
271 |
taraf_hadith = df['bookid_hadithid'].to_list()
|
272 |
+
list_of_lists = [hadith_lookup[i] for i in taraf_hadith]
|
273 |
+
flattened = list(set([elem for sublist in list_of_lists for elem in sublist]))
|
274 |
+
|
275 |
+
isnad_hadith = isnad_info.iloc[flattened][['Source', 'Destination']]
|
276 |
isnad_hadith[['Source', 'Destination']] = isnad_hadith[['Source', 'Destination']].astype(int)
|
277 |
|
278 |
# Merge isnad_hadith with narrator_bios for Teacher and Student
|
|
|
338 |
end_node.setdefault(node, []).append(str(idx))
|
339 |
|
340 |
# Update the graph
|
341 |
+
list_of_lists = [hadith_lookup[i] for i in matns_with_narrator]
|
342 |
+
flattened = list(set([elem for sublist in list_of_lists for elem in sublist]))
|
343 |
+
|
344 |
+
isnad_hadith = isnad_info.iloc[flattened][['Source', 'Destination']]
|
345 |
G = nx.from_pandas_edgelist(isnad_hadith, source = 'Source', target = 'Destination', create_using = nx.DiGraph())
|
346 |
isnad_pos = nx.nx_agraph.graphviz_layout(G, prog='dot')
|
347 |
|