{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "ExecuteTime": { "end_time": "2018-04-20T15:57:58.061370Z", "start_time": "2018-04-20T15:57:57.061631Z" }, "collapsed": true }, "outputs": [], "source": [ "import os\n", "import pandas as pd\n", "import gspread\n", "from oauth2client.service_account import ServiceAccountCredentials" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "ExecuteTime": { "end_time": "2018-04-20T15:57:58.201912Z", "start_time": "2018-04-20T15:57:58.191494Z" }, "collapsed": true }, "outputs": [], "source": [ "scope = ['https://spreadsheets.google.com/feeds']\n", "secrets = \"/Users/jeriwieringa/Dissertation/dev/code/secrets/dissertation-881847769b13.json\"\n", "credentials = ServiceAccountCredentials.from_json_keyfile_name(secrets, scope)" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "ExecuteTime": { "end_time": "2018-04-20T15:57:59.096139Z", "start_time": "2018-04-20T15:57:58.930781Z" }, "collapsed": true }, "outputs": [], "source": [ "gc = gspread.authorize(credentials)" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "ExecuteTime": { "end_time": "2018-04-20T15:58:02.540232Z", "start_time": "2018-04-20T15:58:00.243833Z" }, "collapsed": true }, "outputs": [], "source": [ "dts = gc.open('Topic Labels').sheet1\n", "frame = pd.DataFrame(dts.get_all_records())" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "ExecuteTime": { "end_time": "2018-04-20T15:58:02.574778Z", "start_time": "2018-04-20T15:58:02.542456Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", " | browser_topic_id | \n", "mallet_topic_id | \n", "topic_category | \n", "topic_label | \n", "topic_prevalence_overall | \n", "topic_words | \n", "
---|---|---|---|---|---|---|
0 | \n", "1 | \n", "0 | \n", "missions | \n", "Missions (Canvassing Work) | \n", "0.02981 | \n", "book canvasser order canvassing brother week s... | \n", "
1 | \n", "2 | \n", "1 | \n", "nutrition | \n", "Nutrition (Recipes) | \n", "0.00927 | \n", "cup water bread egg add cream salt flour milk ... | \n", "
2 | \n", "3 | \n", "2 | \n", "scan_errors | \n", "Scan Errors (OCR Errors) | \n", "0.03660 | \n", "ing tion ment sign ness com ter tions great en... | \n", "
3 | \n", "4 | \n", "3 | \n", "social_commentary | \n", "Social Commentary (Suffering and Death from Vi... | \n", "0.03036 | \n", "death man blood men like life hand victim poor... | \n", "
4 | \n", "5 | \n", "4 | \n", "spiritual_growth | \n", "Spiritual Growth (Christian Life - Perseverance) | \n", "0.02033 | \n", "shall lord unto faith thing hope trial christ ... | \n", "
5 | \n", "6 | \n", "5 | \n", "sermons | \n", "Sermons (Religious Practice) | \n", "0.10352 | \n", "thing know think way man want let doe right go... | \n", "
6 | \n", "7 | \n", "6 | \n", "bible | \n", "Bible (Stories from Daniel and Babylonian Capt... | \n", "0.01276 | \n", "king daniel babylon jerusalem lord kingdom neb... | \n", "
7 | \n", "8 | \n", "7 | \n", "scan_errors | \n", "Scan Errors (OCR Errors 2) | \n", "0.04291 | \n", "ing lie review end herald ill tie ile tho good... | \n", "
8 | \n", "9 | \n", "8 | \n", "spiritual_growth | \n", "Spiritual Growth (Christian Behavior) | \n", "0.01902 | \n", "prayer lord heart spirit blessing let church m... | \n", "
9 | \n", "10 | \n", "9 | \n", "reports_on_the_cause | \n", "Reports on the Cause (\"Progress of the Cause\") | \n", "0.01000 | \n", "meeting church brother lord sabbath truth held... | \n", "