시간 기반 필터링

Python 중급 네트워크 분석

Eric Ma

Data Carpentry instructor and author of nxviz package

핵심 개념

  • 그래프 필터링

  • Datetime

  • 시각화

Python 중급 네트워크 분석

엣지 필터링

list(G.edges(data=True))[0:5]
[(0, 17, {'sale_count': 1}),
 (0, 18, {'sale_count': 1}),
 (0, 19, {'sale_count': 2}),
 (0, 12, {'sale_count': 14}),
 (0, 13, {'sale_count': 9})]
[(u, v) for u, v, d in G.edges(data=True) if d['sale_count'] >= 10]
[(0, 12), (1, 19), (5, 16), (6, 13), (7, 17), (7, 19), (8, 18)]
Python 중급 네트워크 분석

Datetime

from datetime import datetime, timedelta

year = 2011 month = 11 day1 = 10 day2 = 6
date1 = datetime(year, month, day1) date2 = datetime(year, month, day2)
date1 > date2
True
Python 중급 네트워크 분석

그래프 시각화

from nxviz import circos
c = circos(G, group_by='bipartite',
              node_color_by='bipartite')

plt.show()

ch4-2.019.png

Python 중급 네트워크 분석

연습해 봅시다!

Python 중급 네트워크 분석

Preparing Video For Download...