Veri setine giriş

Python ile Orta Düzey Ağ (Network) Analizi

Eric Ma

Data Carpentry instructor and author of nxviz package

Veri seti ve vaka çalışmasına giriş

  • Üniversite forum gönderileri veri seti, 6 ay
  • Düğüm bölümleri: öğrenciler, forumlar
  • Bu bölümdeki işlemler:
    • pandas DataFrame'den grafik kurma
    • İki parçalı bir grafiğin tek parçalı izdüşümlerini hesaplama
    • Görselleştirme
    • Zaman serisi filtreleme ve analiz
  • Önceki işlevlerin özeti
Python ile Orta Düzey Ağ (Network) Analizi

DataFrame'lerden grafikler

df
   customers    products
0  customerA    product1
1  customerB    product2
...
list(G = nx.Graph())

G.add_nodes_from(df['products'], bipartite='products') G.add_nodes_from(df['customers'], bipartite='customers')
list(G.nodes())
['product1', 'customerC', 'product2', 'customerB', 'customerA']
list(G.edges())
[]
Python ile Orta Düzey Ağ (Network) Analizi

DataFrame'lerden grafikler

G.add_edges_from(zip(df['customers'], df['products']))

list(G.edges())
[('product1', 'customerC'), ('product1', 'customerA'), 
    ('customerC', 'product2'), ('product2', 'customerB')]
Python ile Orta Düzey Ağ (Network) Analizi

İki parçalı izdüşümler

cust_nodes = [n for n in G.nodes() if G.node[n]
                 ['bipartite'] == 'customers']

prod_nodes = [n for n in G.nodes() if G.node[n] ['bipartite'] == 'products']
prodG = nx.bipartite.projected_graph(G, nodes=prod_nodes) custG = nx.bipartite.projected_graph(G, nodes=cust_nodes)
list(prodG.nodes())
['product1', 'product2']
list(custG.nodes())
['customerC', 'customerB', 'customerA']
Python ile Orta Düzey Ağ (Network) Analizi

Haydi pratik yapalım!

Python ile Orta Düzey Ağ (Network) Analizi

Preparing Video For Download...