{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Sentiment Analysis of the Freedom Suit Cranch Reports" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This uses the coding language python to help find \n", "the sentiment of William Cranch as he analyzed \n", "freedom suits in his 19th Century Court Reports. " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "These are libraries which contain tools to help analyze the text" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "import seaborn as sns\n", "import datetime as dt\n", "%matplotlib inline" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "a dataframe is a useful storage tool to help manipulate the data" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "data = pd.read_csv(\"cranchfiles.csv\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This is the collected data reports the Case Name, Date, and Report Text by Cranch" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
CaseDateCranch ReportCase Text
0Amelia Ward v. Elias B. CaldwellOctober 1823Negro Amelia v. E. B. Caldwell.\\n\\nA slave car...NaN
1Amey v. Joseph ThomasApril 1807Ex Parte Negro Amy. If the owner of a slave wh...NaN
2Ann Bell, Daniel Bell, & David Bell v. Gerard ...March 1840Negro Ann Bell and Children v. Gerard T. Green...NaN
3Ann Brooks v. William D. NuttOctober 1834Negress Ann Brooks v. Nutt, Administrator of F...NaN
4Julia Roberts v. Austin L. Adams & Ann C. HardingJanuary 1844Austin L. Adams and Ann C. Harding, Plaintiffs...NaN
\n", "
" ], "text/plain": [ " Case Date \\\n", "0 Amelia Ward v. Elias B. Caldwell October 1823 \n", "1 Amey v. Joseph Thomas April 1807 \n", "2 Ann Bell, Daniel Bell, & David Bell v. Gerard ... March 1840 \n", "3 Ann Brooks v. William D. Nutt October 1834 \n", "4 Julia Roberts v. Austin L. Adams & Ann C. Harding January 1844 \n", "\n", " Cranch Report Case Text \n", "0 Negro Amelia v. E. B. Caldwell.\\n\\nA slave car... NaN \n", "1 Ex Parte Negro Amy. If the owner of a slave wh... NaN \n", "2 Negro Ann Bell and Children v. Gerard T. Green... NaN \n", "3 Negress Ann Brooks v. Nutt, Administrator of F... NaN \n", "4 Austin L. Adams and Ann C. Harding, Plaintiffs... NaN " ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data.head()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "this shows the text in full as it was scraped from the http://earlywashingtondc.org/ website " ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'Negro William Foster v. William Simmons.\\n\\nAn importation of a slave from the county of Alexandria, into the county of Washington, is an importation into the State of Maryland, within the meaning of the Act of 1796, c. 67, as adopted by Congress on the twenty-seventh of February, 1801.\\n\\nPetition for freedom on the ground that the petitioner was born and on the 27th of February, 1801, resided in that part of the District of Columbia, which was ceded by Virginia to the United States, with Mr. Chapman, his owner, who sold him to Mr. Payne, who sold him to the defendant in Washington county, in this district, and sent him to the defendant, from the county of Alexandria, into this county. By the Act of Congress of the 27th of February, 1801, [2 Stat. at Large, 103,] it is enacted that the laws of Maryland, as they then existed, should continue in force in that part of the district which was ceded by that State. And the Act of Maryland, 1796, c. 67, was then in force, by which it is enacted \"that it shall not be lawful to import or bring into this State, by land or water any negro, mulatto, or other slave for sale or to reside in this State; and any person brought into this State as a slave contrary to this act, if a slave before, shall thereupon cease to be the property of the person so importing, &c., and shall be free.\"\\n\\nMr. Caldwell, for the defendant, moved the Court to instruct the jury, that if they should find that on the twenty-seventh of February, eighteen hundred and one, the petitioner resided with, or under the authority of his master in Alexandria, his master had a right to send him into the county of Washington, and the petitioner did not thereby gain his freedom.\\n\\nMr. Mason, on the same side, contended that all locality as States ceased as to the two parts of the district at the time of the transfer of jurisdiction by the two States to the United States. That a law for the forfeiture of property ought to be construed strictly in favor of the property in the master. That neither the letter nor spirit of the Act of Maryland has been violated. That the defendant has not brought a slave into the State of Maryland. Mr. Jones and Mr. Hiort, for the petitioner, contended, that as the law in Washington county was to continue as it was before the twenty-seventh of February, eighteen hundred and one, and as the law before that day, in the county of Washington, was, that no slave could be lawfully imported into that county, the law is the same yet, and that a bringing from Alexandria county to Washington is the same as from Virginia to Maryland. If this adopted law is to be construed so strictly, there is no limitation to importation of slaves, even directly from Africa. The Act of Congress of the third of May, 1802, c. 52, § 7, [2 Stat. at Large, 193,] only authorizes slaves to be brought from Virginia and Maryland into the district as they might before the twenty-seventh of February, 1801. That is, Virginia slaves may be brought into Alexandria county, and Maryland slaves into Washington county, but it does not authorize the bringing of slaves from Virginia into Maryland, nor from Maryland into Virginia. Lacy carried Lee\\'s slaves from Alexandria to Georgetown, and the Court decided it was a carrying out of the State of Virginia, within the meaning of the Act of Assembly of Virginia of the 25th of January, 1798, § 6 and 7, p. 374.\\n\\nThe Court (nem. con.) refused the instruction, saying that they must take the whole act, or no part of it. If this construction be not given to the statute, there is no law to prevent the importation of slaves into the District of Columbia. It was the intention of Congress to continue in force in this part of the district all the laws as they then existed.'" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data.loc[86,'Cranch Report']" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "shows the full text from each report if I want" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 91 entries, 0 to 90\n", "Data columns (total 6 columns):\n", "Case 91 non-null object\n", "Date 91 non-null object\n", "Cranch Report 91 non-null object\n", "Case Text 0 non-null float64\n", "alph Report 91 non-null object\n", "lower report 91 non-null object\n", "dtypes: float64(1), object(5)\n", "memory usage: 4.4+ KB\n" ] } ], "source": [ "data.info()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "these new columns are the text modified by removing the punctuation and making the text lower case" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "data['alph Report'] = data['Cranch Report'].str.replace('[^\\w\\s]','')" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "data['lower report'] = data['alph Report'].str.lower()" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
CaseDateCranch ReportCase Textalph Reportlower report
0Amelia Ward v. Elias B. CaldwellOctober 1823Negro Amelia v. E. B. Caldwell.\\n\\nA slave car...NaNNegro Amelia v E B Caldwell\\n\\nA slave carried...negro amelia v e b caldwell\\n\\na slave carried...
1Amey v. Joseph ThomasApril 1807Ex Parte Negro Amy. If the owner of a slave wh...NaNEx Parte Negro Amy If the owner of a slave who...ex parte negro amy if the owner of a slave who...
2Ann Bell, Daniel Bell, & David Bell v. Gerard ...March 1840Negro Ann Bell and Children v. Gerard T. Green...NaNNegro Ann Bell and Children v Gerard T Greenfi...negro ann bell and children v gerard t greenfi...
3Ann Brooks v. William D. NuttOctober 1834Negress Ann Brooks v. Nutt, Administrator of F...NaNNegress Ann Brooks v Nutt Administrator of Fin...negress ann brooks v nutt administrator of fin...
4Julia Roberts v. Austin L. Adams & Ann C. HardingJanuary 1844Austin L. Adams and Ann C. Harding, Plaintiffs...NaNAustin L Adams and Ann C Harding Plaintiffs in...austin l adams and ann c harding plaintiffs in...
\n", "
" ], "text/plain": [ " Case Date \\\n", "0 Amelia Ward v. Elias B. Caldwell October 1823 \n", "1 Amey v. Joseph Thomas April 1807 \n", "2 Ann Bell, Daniel Bell, & David Bell v. Gerard ... March 1840 \n", "3 Ann Brooks v. William D. Nutt October 1834 \n", "4 Julia Roberts v. Austin L. Adams & Ann C. Harding January 1844 \n", "\n", " Cranch Report Case Text \\\n", "0 Negro Amelia v. E. B. Caldwell.\\n\\nA slave car... NaN \n", "1 Ex Parte Negro Amy. If the owner of a slave wh... NaN \n", "2 Negro Ann Bell and Children v. Gerard T. Green... NaN \n", "3 Negress Ann Brooks v. Nutt, Administrator of F... NaN \n", "4 Austin L. Adams and Ann C. Harding, Plaintiffs... NaN \n", "\n", " alph Report \\\n", "0 Negro Amelia v E B Caldwell\\n\\nA slave carried... \n", "1 Ex Parte Negro Amy If the owner of a slave who... \n", "2 Negro Ann Bell and Children v Gerard T Greenfi... \n", "3 Negress Ann Brooks v Nutt Administrator of Fin... \n", "4 Austin L Adams and Ann C Harding Plaintiffs in... \n", "\n", " lower report \n", "0 negro amelia v e b caldwell\\n\\na slave carried... \n", "1 ex parte negro amy if the owner of a slave who... \n", "2 negro ann bell and children v gerard t greenfi... \n", "3 negress ann brooks v nutt administrator of fin... \n", "4 austin l adams and ann c harding plaintiffs in... " ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data.head()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "this gets rid of the newline or '/n' character " ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [], "source": [ "data['non'] = data['lower report'].str.replace('\\n', '')" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
CaseDateCranch ReportCase Textalph Reportlower reportnon
0Amelia Ward v. Elias B. CaldwellOctober 1823Negro Amelia v. E. B. Caldwell.\\n\\nA slave car...NaNNegro Amelia v E B Caldwell\\n\\nA slave carried...negro amelia v e b caldwell\\n\\na slave carried...negro amelia v e b caldwella slave carried fro...
1Amey v. Joseph ThomasApril 1807Ex Parte Negro Amy. If the owner of a slave wh...NaNEx Parte Negro Amy If the owner of a slave who...ex parte negro amy if the owner of a slave who...ex parte negro amy if the owner of a slave who...
2Ann Bell, Daniel Bell, & David Bell v. Gerard ...March 1840Negro Ann Bell and Children v. Gerard T. Green...NaNNegro Ann Bell and Children v Gerard T Greenfi...negro ann bell and children v gerard t greenfi...negro ann bell and children v gerard t greenfi...
3Ann Brooks v. William D. NuttOctober 1834Negress Ann Brooks v. Nutt, Administrator of F...NaNNegress Ann Brooks v Nutt Administrator of Fin...negress ann brooks v nutt administrator of fin...negress ann brooks v nutt administrator of fin...
4Julia Roberts v. Austin L. Adams & Ann C. HardingJanuary 1844Austin L. Adams and Ann C. Harding, Plaintiffs...NaNAustin L Adams and Ann C Harding Plaintiffs in...austin l adams and ann c harding plaintiffs in...austin l adams and ann c harding plaintiffs in...
\n", "
" ], "text/plain": [ " Case Date \\\n", "0 Amelia Ward v. Elias B. Caldwell October 1823 \n", "1 Amey v. Joseph Thomas April 1807 \n", "2 Ann Bell, Daniel Bell, & David Bell v. Gerard ... March 1840 \n", "3 Ann Brooks v. William D. Nutt October 1834 \n", "4 Julia Roberts v. Austin L. Adams & Ann C. Harding January 1844 \n", "\n", " Cranch Report Case Text \\\n", "0 Negro Amelia v. E. B. Caldwell.\\n\\nA slave car... NaN \n", "1 Ex Parte Negro Amy. If the owner of a slave wh... NaN \n", "2 Negro Ann Bell and Children v. Gerard T. Green... NaN \n", "3 Negress Ann Brooks v. Nutt, Administrator of F... NaN \n", "4 Austin L. Adams and Ann C. Harding, Plaintiffs... NaN \n", "\n", " alph Report \\\n", "0 Negro Amelia v E B Caldwell\\n\\nA slave carried... \n", "1 Ex Parte Negro Amy If the owner of a slave who... \n", "2 Negro Ann Bell and Children v Gerard T Greenfi... \n", "3 Negress Ann Brooks v Nutt Administrator of Fin... \n", "4 Austin L Adams and Ann C Harding Plaintiffs in... \n", "\n", " lower report \\\n", "0 negro amelia v e b caldwell\\n\\na slave carried... \n", "1 ex parte negro amy if the owner of a slave who... \n", "2 negro ann bell and children v gerard t greenfi... \n", "3 negress ann brooks v nutt administrator of fin... \n", "4 austin l adams and ann c harding plaintiffs in... \n", "\n", " non \n", "0 negro amelia v e b caldwella slave carried fro... \n", "1 ex parte negro amy if the owner of a slave who... \n", "2 negro ann bell and children v gerard t greenfi... \n", "3 negress ann brooks v nutt administrator of fin... \n", "4 austin l adams and ann c harding plaintiffs in... " ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data.head()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This is a sentiment lexicon and analyzer that we will use to determine the sentiment of the words in the text" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [], "source": [ "from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer\n", "analyzer = SentimentIntensityAnalyzer()" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [], "source": [ "def sentiment_analyzer_scores(sentence):\n", " score = analyser.polarity_scores(sentence)\n", " print(\"{:-<40} {}\".format(sentence, str(score)))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "the analyzer gives the text a positive, neutral, negative, and compound score" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "negro thomas butler et al v gabriel duvallslaves removed by their owner from maryland or georgetown in the district of columbia to virginia and kept therein one whole year are entitled to freedom under the law of virginia unless the owner took the oath prescribed by that law within the time thereby limited but after the lapse of twentyfive or thirty years the jury may presume that such oath was taken as prescribed and within the limited timeslaves carried by the owner from virginia to maryland with intent to reside therein are entitled to freedom if slaves be removed by their owner from virginia to the county of washington dc and there sold within three years after such removal the jury may infer that they were imported for sale and if so they are entitled to freedomthis was a petition for freedomupon the trial the following instructions were given by the court to the jury1 upon the prayer of mr coxe for the petitionersthat if the jury shall believe from the evidence aforesaid that dales was the owner of the petitioners or their parents in the state of maryland or in georgetown in the district of columbia and resided with them there and subsequently removed to virginia and kept them in that state one whole year together that then the said petitioners are entitled to their freedom under the law of virginia unless the said dales within the time specified in the virginia law complied with the requisitions of that law by taking the oath therein prescribed2 but at the prayer of mr jones for the defendant further instructed them that if they believe from the evidence that such removal to virginia of the said slaves was more than twentyfive to thirty years before the bringing of this petition that during all the time the said dales lived whether in virginia in maryland or in the district of columbia the petitioners were continually held and used as slaves either by the said dales or by the defendant as purchaser from him that the said slaves were purchased by said duvall of the said dales more than twenty years before the bringing of this petition and have been held by him as slaves by virtue of that purchase ever since and that the said dales died some years before the filing of this petition then it is not necessary for this defendant to offer further evidence to prove a compliance on the part of said dales with said requisitions of the virginia law but such compliance may be presumed and the burden of proving the contrary thrown on the petitioners3 on the prayer of mr coxe for the petitioners that if the jury shall believe from the evidence aforesaid that the said dales owner of said petitioners as aforesaid resided with the said petitioners in virginia and sold them while he so resided to the defendant whether said sale was made in georgetown or in virginia the defendant then residing in washington county dc who then carried said slaves to prince georges county with intent to reside therein then the petitioners are entitled to their freedomand in such case if the said slaves and their master resided in the state of virginia and their said master removed with them to the district of columbia and sold them within three years after such removal then the jury may infer that the said slaves were imported with intent to sell them and if so they are entitled to their freedommr jones in support of his prayer no 2 cited matilda v mason in this court at october term 1821 2 cranch c c 343 and sc 12 wheat 590 on writ of error murray v mccarthy 2 mun 393 abraham v matthew 6 mun 159verdict for the petitioners motion for new trial overruled no writ of error taken {'neg': 0.037, 'neu': 0.909, 'pos': 0.054, 'compound': 0.9151}\n" ] } ], "source": [ "sentiment_analyzer_scores(data.loc[80,'non'])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "this adds columns that have all the scores from the analyzer" ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [], "source": [ "sentiment = data['non'].apply(lambda x: analyzer.polarity_scores(x))\n", "df = pd.concat([data,sentiment.apply(pd.Series)],1)" ] }, { "cell_type": "code", "execution_count": 18, "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
CaseDateCranch ReportCase Textalph Reportlower reportnonnegneuposcompound
0Amelia Ward v. Elias B. CaldwellOctober 1823Negro Amelia v. E. B. Caldwell.\\n\\nA slave car...NaNNegro Amelia v E B Caldwell\\n\\nA slave carried...negro amelia v e b caldwell\\n\\na slave carried...negro amelia v e b caldwella slave carried fro...0.0250.8820.0920.9804
1Amey v. Joseph ThomasApril 1807Ex Parte Negro Amy. If the owner of a slave wh...NaNEx Parte Negro Amy If the owner of a slave who...ex parte negro amy if the owner of a slave who...ex parte negro amy if the owner of a slave who...0.0560.8300.1140.8613
2Ann Bell, Daniel Bell, & David Bell v. Gerard ...March 1840Negro Ann Bell and Children v. Gerard T. Green...NaNNegro Ann Bell and Children v Gerard T Greenfi...negro ann bell and children v gerard t greenfi...negro ann bell and children v gerard t greenfi...0.0400.8690.0910.9940
3Ann Brooks v. William D. NuttOctober 1834Negress Ann Brooks v. Nutt, Administrator of F...NaNNegress Ann Brooks v Nutt Administrator of Fin...negress ann brooks v nutt administrator of fin...negress ann brooks v nutt administrator of fin...0.0190.9270.0540.9375
4Julia Roberts v. Austin L. Adams & Ann C. HardingJanuary 1844Austin L. Adams and Ann C. Harding, Plaintiffs...NaNAustin L Adams and Ann C Harding Plaintiffs in...austin l adams and ann c harding plaintiffs in...austin l adams and ann c harding plaintiffs in...0.0280.8880.0840.9994
\n", "
" ], "text/plain": [ " Case Date \\\n", "0 Amelia Ward v. Elias B. Caldwell October 1823 \n", "1 Amey v. Joseph Thomas April 1807 \n", "2 Ann Bell, Daniel Bell, & David Bell v. Gerard ... March 1840 \n", "3 Ann Brooks v. William D. Nutt October 1834 \n", "4 Julia Roberts v. Austin L. Adams & Ann C. Harding January 1844 \n", "\n", " Cranch Report Case Text \\\n", "0 Negro Amelia v. E. B. Caldwell.\\n\\nA slave car... NaN \n", "1 Ex Parte Negro Amy. If the owner of a slave wh... NaN \n", "2 Negro Ann Bell and Children v. Gerard T. Green... NaN \n", "3 Negress Ann Brooks v. Nutt, Administrator of F... NaN \n", "4 Austin L. Adams and Ann C. Harding, Plaintiffs... NaN \n", "\n", " alph Report \\\n", "0 Negro Amelia v E B Caldwell\\n\\nA slave carried... \n", "1 Ex Parte Negro Amy If the owner of a slave who... \n", "2 Negro Ann Bell and Children v Gerard T Greenfi... \n", "3 Negress Ann Brooks v Nutt Administrator of Fin... \n", "4 Austin L Adams and Ann C Harding Plaintiffs in... \n", "\n", " lower report \\\n", "0 negro amelia v e b caldwell\\n\\na slave carried... \n", "1 ex parte negro amy if the owner of a slave who... \n", "2 negro ann bell and children v gerard t greenfi... \n", "3 negress ann brooks v nutt administrator of fin... \n", "4 austin l adams and ann c harding plaintiffs in... \n", "\n", " non neg neu pos \\\n", "0 negro amelia v e b caldwella slave carried fro... 0.025 0.882 0.092 \n", "1 ex parte negro amy if the owner of a slave who... 0.056 0.830 0.114 \n", "2 negro ann bell and children v gerard t greenfi... 0.040 0.869 0.091 \n", "3 negress ann brooks v nutt administrator of fin... 0.019 0.927 0.054 \n", "4 austin l adams and ann c harding plaintiffs in... 0.028 0.888 0.084 \n", "\n", " compound \n", "0 0.9804 \n", "1 0.8613 \n", "2 0.9940 \n", "3 0.9375 \n", "4 0.9994 " ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df.head()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "I removed some columns for simplicty" ] }, { "cell_type": "code", "execution_count": 20, "metadata": {}, "outputs": [], "source": [ "df = df.drop(columns=['Case Text', 'alph Report','lower report'])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "this graph shows the amount of positive compound sentiments" ] }, { "cell_type": "code", "execution_count": 21, "metadata": {}, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAkkAAAE9CAYAAAAf2/Z+AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO3dd3hc133m8fc3DYPeSYJgA5tISmwSBYlWsyV7LStySSLHsuSW2JGTOG03T3p2s052k2w22Wxie23LVVYil9iyLclyi2xRlaRIiaTYKXYSBAGid0w5+8cMKJC6JAcEZu4M8f08zzxTcedH3invnHPuOeacEwAAAM4V8LsAAACAfERIAgAA8EBIAgAA8EBIAgAA8EBIAgAA8EBIAgAA8BDKxkbr6urcggULsrFpAACAKbV169Yzzrn682/PSkhasGCBtmzZko1NAwAATCkzO+p1O91tAAAAHghJAAAAHghJA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ASAIAAPBASAIAAPBASAIAAPBASAIAAPDw/wEfgR25l8uHOQAAAABJRU5ErkJggg==\n", "text/plain": [ "
" ] }, "metadata": { "needs_background": "light" }, "output_type": "display_data" } ], "source": [ "fig = plt.figure(figsize=(10,5))\n", "ax = fig.add_subplot(111)\n", "sns.distplot(df['compound'], bins=15, ax=ax)\n", "plt.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "this adds a new column to simplify if the reviews are positive or negative" ] }, { "cell_type": "code", "execution_count": 22, "metadata": {}, "outputs": [], "source": [ "df['sentiment'] = 'negative'\n", "df.loc[df['compound'] > 0.0,'sentiment'] = 'positive'" ] }, { "cell_type": "code", "execution_count": 23, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
CaseDateCranch Reportnonnegneuposcompoundsentiment
0Amelia Ward v. Elias B. CaldwellOctober 1823Negro Amelia v. E. B. Caldwell.\\n\\nA slave car...negro amelia v e b caldwella slave carried fro...0.0250.8820.0920.9804positive
1Amey v. Joseph ThomasApril 1807Ex Parte Negro Amy. If the owner of a slave wh...ex parte negro amy if the owner of a slave who...0.0560.8300.1140.8613positive
2Ann Bell, Daniel Bell, & David Bell v. Gerard ...March 1840Negro Ann Bell and Children v. Gerard T. Green...negro ann bell and children v gerard t greenfi...0.0400.8690.0910.9940positive
3Ann Brooks v. William D. NuttOctober 1834Negress Ann Brooks v. Nutt, Administrator of F...negress ann brooks v nutt administrator of fin...0.0190.9270.0540.9375positive
4Julia Roberts v. Austin L. Adams & Ann C. HardingJanuary 1844Austin L. Adams and Ann C. Harding, Plaintiffs...austin l adams and ann c harding plaintiffs in...0.0280.8880.0840.9994positive
\n", "
" ], "text/plain": [ " Case Date \\\n", "0 Amelia Ward v. Elias B. Caldwell October 1823 \n", "1 Amey v. Joseph Thomas April 1807 \n", "2 Ann Bell, Daniel Bell, & David Bell v. Gerard ... March 1840 \n", "3 Ann Brooks v. William D. Nutt October 1834 \n", "4 Julia Roberts v. Austin L. Adams & Ann C. Harding January 1844 \n", "\n", " Cranch Report \\\n", "0 Negro Amelia v. E. B. Caldwell.\\n\\nA slave car... \n", "1 Ex Parte Negro Amy. If the owner of a slave wh... \n", "2 Negro Ann Bell and Children v. Gerard T. Green... \n", "3 Negress Ann Brooks v. Nutt, Administrator of F... \n", "4 Austin L. Adams and Ann C. Harding, Plaintiffs... \n", "\n", " non neg neu pos \\\n", "0 negro amelia v e b caldwella slave carried fro... 0.025 0.882 0.092 \n", "1 ex parte negro amy if the owner of a slave who... 0.056 0.830 0.114 \n", "2 negro ann bell and children v gerard t greenfi... 0.040 0.869 0.091 \n", "3 negress ann brooks v nutt administrator of fin... 0.019 0.927 0.054 \n", "4 austin l adams and ann c harding plaintiffs in... 0.028 0.888 0.084 \n", "\n", " compound sentiment \n", "0 0.9804 positive \n", "1 0.8613 positive \n", "2 0.9940 positive \n", "3 0.9375 positive \n", "4 0.9994 positive " ] }, "execution_count": 23, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df.head()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This counts the amount of positive and negative reviews, showing that most of Cranch's reports were quite positive!" ] }, { "cell_type": "code", "execution_count": 24, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "positive 77\n", "negative 14\n", "Name: sentiment, dtype: int64" ] }, "execution_count": 24, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df['sentiment'].value_counts()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.4" } }, "nbformat": 4, "nbformat_minor": 2 }