In [2]:
import sys
sys.path.append('../../code/')
import os
import json
from datetime import datetime
import time
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import scipy.stats as stats
import networkx as nx
from load_data import load_citation_network, case_info
%load_ext autoreload
%autoreload 2
%matplotlib inline
data_dir = '../../data/'
court_name = 'all'
In [ ]:
# # this will be a little slow the first time you run it
# G = load_citation_network(data_dir, court_name)
# print 'loaded %s network with %d cases and %d edges' % (court_name, len(G.nodes()), len(G.edges()))
In [3]:
case_metadata = pd.read_csv(data_dir + 'clean/case_metadata_master.csv',
index_col='id')
edgelist = pd.read_csv(data_dir + 'clean/edgelist_master.csv')
In [6]:
G = nx.DiGraph()
G.add_nodes_from(case_metadata.index.tolist())
nx.set_node_attributes(G, 'date', case_metadata['date'].to_dict())
In [ ]:
for index, edge in edgelist.iterrows():
ing = edge['citing']
ed = edge['cited']
G.add_edge(ing, ed)
In [ ]:
In [ ]: