{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# 1.Data Exploration" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 1.1.Establishing a Connection" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We start by importing all necessary libraries" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": true }, "outputs": [], "source": [ "from py2neo import Graph # to connect to our neo4j Graph database\n", "from pandas import DataFrame\n", "import pandas as pd\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "from sklearn.preprocessing import normalize\n", "import itertools\n", "#https://gist.github.com/DaniSancas/1d5265fc159a95ff457b940fc5046887 Cypher cheatsheet" ] }, { "cell_type": "markdown", "metadata": { "collapsed": true }, "source": [ "Connect to running instance of Neo4J" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": true }, "outputs": [], "source": [ "graph_url = \"http://localhost:7474/db/data\"\n", "graph = Graph(graph_url)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Test the connection by returning, for example, some of the countries in the database. " ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | Country | \n", "
---|---|
0 | \n", "Australia | \n", "
1 | \n", "Belgium | \n", "
2 | \n", "United States of America | \n", "
3 | \n", "Brazil | \n", "
4 | \n", "Canada | \n", "
5 | \n", "Poland | \n", "
6 | \n", "Germany | \n", "
7 | \n", "Finland | \n", "
8 | \n", "People's Republic of China | \n", "
9 | \n", "Czech Republic | \n", "