{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Making networkx graphs from source-target DataFrames" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Imports/setup\n", "\n", "Let's just get all of this out of the way up top." ] }, { "cell_type": "code", "execution_count": 19, "metadata": { "collapsed": true }, "outputs": [], "source": [ "%matplotlib inline\n", "\n", "import pandas as pd\n", "import networkx as nx\n", "\n", "# Ignore matplotlib warnings\n", "import warnings\n", "warnings.filterwarnings(\"ignore\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Let's deal with our data!\n", "\n", "### First, read it in as a normal dataframe" ] }, { "cell_type": "code", "execution_count": 20, "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/html": [ "
\n", " | name | \n", "club | \n", "
---|---|---|
0 | \n", "Adams John | \n", "North Caucus | \n", "
1 | \n", "Adams John | \n", "Long Room Club | \n", "
2 | \n", "Adams Samuel | \n", "North Caucus | \n", "
3 | \n", "Adams Samuel | \n", "Long Room Club | \n", "
4 | \n", "Adams Samuel | \n", "Boston Committee | \n", "