Created
May 21, 2014 14:19
-
-
Save springcoil/75dc4d6a292796b41553 to your computer and use it in GitHub Desktop.
IPython Notebook - for MongoDB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "metadata": { | |
| "name": "", | |
| "signature": "sha256:2c5a94596837b925899f0aab294f5a5d31a0c6227abf97c00b871ecbe116bcdf" | |
| }, | |
| "nbformat": 3, | |
| "nbformat_minor": 0, | |
| "worksheets": [ | |
| { | |
| "cells": [ | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "!pwd" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "output_type": "stream", | |
| "stream": "stdout", | |
| "text": [ | |
| "/home/peadar/Code/NHLPlayoff\r\n" | |
| ] | |
| } | |
| ], | |
| "prompt_number": 1 | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "# Let us import PyMongo and connect to the MongoDB database.\n", | |
| "import pymongo\n", | |
| "con = pymongo.Connection('localhost', port=27017)\n", | |
| "tweets = con.db.tweets\n", | |
| "cursor = tweets.find()\n" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "ename": "NameError", | |
| "evalue": "name 'nofollows' is not defined", | |
| "output_type": "pyerr", | |
| "traceback": [ | |
| "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)", | |
| "\u001b[1;32m<ipython-input-50-29c59fa9e23f>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m 4\u001b[0m \u001b[0mtweets\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mcon\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mdb\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mtweets\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 5\u001b[0m \u001b[0mcursor\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mtweets\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mfind\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 6\u001b[1;33m \u001b[1;32mfor\u001b[0m \u001b[0mii\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mxrange\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0mlen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mnofollows\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m100\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 7\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 8\u001b[0m \u001b[1;31m# For convenience/to get around a twython issue, we convert each user_id to a string\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", | |
| "\u001b[1;31mNameError\u001b[0m: name 'nofollows' is not defined" | |
| ] | |
| } | |
| ], | |
| "prompt_number": 50 | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "# The aim of this code is to replicate the NHL analysis from Daniel Forsythe, and translate it to a different usecase.\n", | |
| "df" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "html": [ | |
| "<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n", | |
| "<table border=\"1\" class=\"dataframe\">\n", | |
| " <tbody>\n", | |
| " <tr>\n", | |
| " <td>Int64Index([], dtype='int64')</td>\n", | |
| " <td>Empty DataFrame</td>\n", | |
| " </tr>\n", | |
| " </tbody>\n", | |
| "</table>\n", | |
| "<p>0 rows \u00d7 0 columns</p>\n", | |
| "</div>" | |
| ], | |
| "metadata": {}, | |
| "output_type": "pyout", | |
| "prompt_number": 49, | |
| "text": [ | |
| "Empty DataFrame\n", | |
| "Columns: []\n", | |
| "Index: []\n", | |
| "\n", | |
| "[0 rows x 0 columns]" | |
| ] | |
| } | |
| ], | |
| "prompt_number": 49 | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "pd.DataFrame.from_records(ryan_giggs)\n" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "html": [ | |
| "<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n", | |
| "<table border=\"1\" class=\"dataframe\">\n", | |
| " <thead>\n", | |
| " <tr style=\"text-align: right;\">\n", | |
| " <th></th>\n", | |
| " <th>{\t_id\t:\t{\t$oid\t:\t537b7257d5820113f4ac818b\t}\t\ttext\t:\t\"\\\"\"@SuperSportTV: BREAKING NEWS: Ryan Giggs will head up a stellar cast of experts for SuperSport\u2019s coverage of the 2014 FIFA World Cup\\\"\"</th>\n", | |
| " <th> \"\"created_at\"\t:\t{\t$date\t:\t1400599127000\t}\t\tgeo\t:\tnull\t\tsource\t:\tTwitter for Android\t}\t\t\t\t\t\t\t\t\t\t\t\t\t\t</th>\n", | |
| " </tr>\n", | |
| " </thead>\n", | |
| " <tbody>\n", | |
| " <tr>\n", | |
| " <th>0 </th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b7257d5820113f4ac818...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>1 </th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b7257d5820113f4ac818...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>2 </th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b7257d5820113f4ac818...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>3 </th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b7259d5820113f4ac818...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>4 </th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b7261d5820113f4ac819...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>5 </th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b7263d5820113f4ac819...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>6 </th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b7267d5820113f4ac819...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>7 </th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b7267d5820113f4ac819...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>8 </th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b7268d5820113f4ac819...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>9 </th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b726bd5820113f4ac819...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>10</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b726dd5820113f4ac819...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>11</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b7275d5820113f4ac819...</td>\n", | |
| " <td> the #FCExtraTime crew discuss Louis van Gaal'...</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>12</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b7275d5820113f4ac819...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>13</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b7278d5820113f4ac819...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>14</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b727cd5820113f4ac819...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>15</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b727dd5820113f4ac819...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>16</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b7280d5820113f4ac819...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>17</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b7280d5820113f4ac819...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>18</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b7280d5820113f4ac819...</td>\n", | |
| " <td> I'm sure he will do a great job\\t\\tcreated_at...</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>19</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b7286d5820113f4ac81a...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>20</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b7286d5820113f4ac81a...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>21</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b7288d5820113f4ac81a...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>22</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b7289d5820113f4ac81a...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>23</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b728ad5820113f4ac81a...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>24</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b728ad5820113f4ac81a...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>25</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b728cd5820113f4ac81a...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>26</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b728dd5820113f4ac81a...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>27</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b728fd5820113f4ac81a...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>28</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b728fd5820113f4ac81a...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>29</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b7290d5820113f4ac81a...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>30</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b7295d5820113f4ac81a...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>31</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b7296d5820113f4ac81a...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>32</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b7298d5820113f4ac81a...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>33</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b729ad5820113f4ac81a...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>34</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b729ad5820113f4ac81a...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>35</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b729cd5820113f4ac81b...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>36</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72a4d5820113f4ac81b...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>37</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72a8d5820113f4ac81b...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>38</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72aad5820113f4ac81b...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>39</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72aad5820113f4ac81b...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>40</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72abd5820113f4ac81b...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>41</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72acd5820113f4ac81b...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>42</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72afd5820113f4ac81b...</td>\n", | |
| " <td> we looks back\\nover the winger\u2019s illustrious ...</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>43</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72b0d5820113f4ac81b...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>44</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72b0d5820113f4ac81b...</td>\n", | |
| " <td> tearing you apart since 1991. The best ever p...</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>45</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72b1d5820113f4ac81b...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>46</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72b1d5820113f4ac81b...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>47</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72b2d5820113f4ac81b...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>48</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72b3d5820113f4ac81b...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>49</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72b3d5820113f4ac81c...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>50</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72b4d5820113f4ac81c...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>51</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72b4d5820113f4ac81c...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>52</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72b4d5820113f4ac81c...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>53</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72b4d5820113f4ac81c...</td>\n", | |
| " <td> the #FCExtraTime crew discuss Louis van Gaal'...</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>54</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72b4d5820113f4ac81c...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>55</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72b6d5820113f4ac81c...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>56</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72b6d5820113f4ac81c...</td>\n", | |
| " <td> the #FCExtraTime crew discuss Louis van Gaal'...</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>57</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72b6d5820113f4ac81c...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>58</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72b9d5820113f4ac81c...</td>\n", | |
| " <td> who have added Ryan Giggs to their panel of a...</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>59</th>\n", | |
| " <td> {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72b9d5820113f4ac81c...</td>\n", | |
| " <td> NaN</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th></th>\n", | |
| " <td>...</td>\n", | |
| " <td>...</td>\n", | |
| " </tr>\n", | |
| " </tbody>\n", | |
| "</table>\n", | |
| "<p>217 rows \u00d7 2 columns</p>\n", | |
| "</div>" | |
| ], | |
| "metadata": {}, | |
| "output_type": "pyout", | |
| "prompt_number": 45, | |
| "text": [ | |
| " {\\t_id\\t:\\t{\\t$oid\\t:\\t537b7257d5820113f4ac818b\\t}\\t\\ttext\\t:\\t\"\\\"\"@SuperSportTV: BREAKING NEWS: Ryan Giggs will head up a stellar cast of experts for SuperSport\u2019s coverage of the 2014 FIFA World Cup\\\"\" \\\n", | |
| "0 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b7257d5820113f4ac818... \n", | |
| "1 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b7257d5820113f4ac818... \n", | |
| "2 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b7257d5820113f4ac818... \n", | |
| "3 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b7259d5820113f4ac818... \n", | |
| "4 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b7261d5820113f4ac819... \n", | |
| "5 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b7263d5820113f4ac819... \n", | |
| "6 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b7267d5820113f4ac819... \n", | |
| "7 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b7267d5820113f4ac819... \n", | |
| "8 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b7268d5820113f4ac819... \n", | |
| "9 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b726bd5820113f4ac819... \n", | |
| "10 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b726dd5820113f4ac819... \n", | |
| "11 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b7275d5820113f4ac819... \n", | |
| "12 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b7275d5820113f4ac819... \n", | |
| "13 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b7278d5820113f4ac819... \n", | |
| "14 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b727cd5820113f4ac819... \n", | |
| "15 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b727dd5820113f4ac819... \n", | |
| "16 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b7280d5820113f4ac819... \n", | |
| "17 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b7280d5820113f4ac819... \n", | |
| "18 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b7280d5820113f4ac819... \n", | |
| "19 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b7286d5820113f4ac81a... \n", | |
| "20 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b7286d5820113f4ac81a... \n", | |
| "21 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b7288d5820113f4ac81a... \n", | |
| "22 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b7289d5820113f4ac81a... \n", | |
| "23 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b728ad5820113f4ac81a... \n", | |
| "24 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b728ad5820113f4ac81a... \n", | |
| "25 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b728cd5820113f4ac81a... \n", | |
| "26 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b728dd5820113f4ac81a... \n", | |
| "27 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b728fd5820113f4ac81a... \n", | |
| "28 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b728fd5820113f4ac81a... \n", | |
| "29 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b7290d5820113f4ac81a... \n", | |
| "30 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b7295d5820113f4ac81a... \n", | |
| "31 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b7296d5820113f4ac81a... \n", | |
| "32 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b7298d5820113f4ac81a... \n", | |
| "33 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b729ad5820113f4ac81a... \n", | |
| "34 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b729ad5820113f4ac81a... \n", | |
| "35 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b729cd5820113f4ac81b... \n", | |
| "36 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72a4d5820113f4ac81b... \n", | |
| "37 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72a8d5820113f4ac81b... \n", | |
| "38 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72aad5820113f4ac81b... \n", | |
| "39 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72aad5820113f4ac81b... \n", | |
| "40 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72abd5820113f4ac81b... \n", | |
| "41 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72acd5820113f4ac81b... \n", | |
| "42 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72afd5820113f4ac81b... \n", | |
| "43 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72b0d5820113f4ac81b... \n", | |
| "44 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72b0d5820113f4ac81b... \n", | |
| "45 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72b1d5820113f4ac81b... \n", | |
| "46 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72b1d5820113f4ac81b... \n", | |
| "47 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72b2d5820113f4ac81b... \n", | |
| "48 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72b3d5820113f4ac81b... \n", | |
| "49 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72b3d5820113f4ac81c... \n", | |
| "50 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72b4d5820113f4ac81c... \n", | |
| "51 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72b4d5820113f4ac81c... \n", | |
| "52 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72b4d5820113f4ac81c... \n", | |
| "53 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72b4d5820113f4ac81c... \n", | |
| "54 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72b4d5820113f4ac81c... \n", | |
| "55 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72b6d5820113f4ac81c... \n", | |
| "56 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72b6d5820113f4ac81c... \n", | |
| "57 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72b6d5820113f4ac81c... \n", | |
| "58 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72b9d5820113f4ac81c... \n", | |
| "59 {\\t_id\\t:\\t{\\t$oid\\t:\\t537b72b9d5820113f4ac81c... \n", | |
| " ... \n", | |
| "\n", | |
| " \"\"created_at\"\\t:\\t{\\t$date\\t:\\t1400599127000\\t}\\t\\tgeo\\t:\\tnull\\t\\tsource\\t:\\tTwitter for Android\\t}\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t \n", | |
| "0 NaN \n", | |
| "1 NaN \n", | |
| "2 NaN \n", | |
| "3 NaN \n", | |
| "4 NaN \n", | |
| "5 NaN \n", | |
| "6 NaN \n", | |
| "7 NaN \n", | |
| "8 NaN \n", | |
| "9 NaN \n", | |
| "10 NaN \n", | |
| "11 the #FCExtraTime crew discuss Louis van Gaal'... \n", | |
| "12 NaN \n", | |
| "13 NaN \n", | |
| "14 NaN \n", | |
| "15 NaN \n", | |
| "16 NaN \n", | |
| "17 NaN \n", | |
| "18 I'm sure he will do a great job\\t\\tcreated_at... \n", | |
| "19 NaN \n", | |
| "20 NaN \n", | |
| "21 NaN \n", | |
| "22 NaN \n", | |
| "23 NaN \n", | |
| "24 NaN \n", | |
| "25 NaN \n", | |
| "26 NaN \n", | |
| "27 NaN \n", | |
| "28 NaN \n", | |
| "29 NaN \n", | |
| "30 NaN \n", | |
| "31 NaN \n", | |
| "32 NaN \n", | |
| "33 NaN \n", | |
| "34 NaN \n", | |
| "35 NaN \n", | |
| "36 NaN \n", | |
| "37 NaN \n", | |
| "38 NaN \n", | |
| "39 NaN \n", | |
| "40 NaN \n", | |
| "41 NaN \n", | |
| "42 we looks back\\nover the winger\u2019s illustrious ... \n", | |
| "43 NaN \n", | |
| "44 tearing you apart since 1991. The best ever p... \n", | |
| "45 NaN \n", | |
| "46 NaN \n", | |
| "47 NaN \n", | |
| "48 NaN \n", | |
| "49 NaN \n", | |
| "50 NaN \n", | |
| "51 NaN \n", | |
| "52 NaN \n", | |
| "53 the #FCExtraTime crew discuss Louis van Gaal'... \n", | |
| "54 NaN \n", | |
| "55 NaN \n", | |
| "56 the #FCExtraTime crew discuss Louis van Gaal'... \n", | |
| "57 NaN \n", | |
| "58 who have added Ryan Giggs to their panel of a... \n", | |
| "59 NaN \n", | |
| " ... \n", | |
| "\n", | |
| "[217 rows x 2 columns]" | |
| ] | |
| } | |
| ], | |
| "prompt_number": 45 | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "= pd.to_datetime(pd.Series(ryan_giggs['created_at']))\n", | |
| "ryan_giggs.setindex('created_at', drop=False, inplace=True)\n", | |
| "ryan_giggs.index = ryan_giggs.index.tzlocalize('GMT').tzconvert('EST')\n", | |
| "ryan_giggs.index = ryan_giggs.index - DateOffset(hours = 12)\n", | |
| "ryan_giggs.index" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [] | |
| } | |
| ], | |
| "metadata": {} | |
| } | |
| ] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment