{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "df = pd.read_csv('death_row_discritized.csv')" ] }, { "cell_type": "code", "execution_count": 28, "metadata": {}, "outputs": [], "source": [ "def to_string(tokens):\n", " try:\n", " return \" \".join(eval(tokens))\n", " except:\n", " return \"error\"\n", " \n", "df['statement_string'] = df.apply(lambda x: to_string(x['last_statement']), axis=1)" ] }, { "cell_type": "code", "execution_count": 29, "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", " \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", " \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", " \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", "
age_receivededucation_levelage_crimeoccupationprior_recordnum_of_vicmain_crimetype_of_crimeweaponco_defendants...vic_kidvic_malevic_femalevic_policeageracecountylast_statementtime_spentstatement_string
0twentiessome_highschooltwentieslaboreryesonemurderotherotherno...nonoyesno35-45whiteEl Paso['yeah', 'first_person_pronoun', 'want', 'to',...10+yeah first_person_pronoun want to address the ...
1thirty+no_highschoolthirty+otheryestwo+murderotherknifeno...yesyesyesno35-45blackDallas['umm', 'pamela', 'can', 'pronoun', 'hear', 'f...10+umm pamela can pronoun hear first_person_prono...
2thirty+no_highschooltwentiesotheryesonemurder_robberygungunyes...nonoyesno35-45hispanicJohnson['its', 'on', 'september', 'th', 'kayla', 'and...10_or_lessits on september th kayla and david first_pers...
3thirty+some_highschoolthirty+laboreryestwo+murderotherknifeno...nonoyesno45+whiteTarrant['hi', 'ladies', 'first_person_pronoun', 'want...10+hi ladies first_person_pronoun wanted to tell ...
4twentiessome_highschooltwentieslaboreryesonemurder_otherotherotherno...nonoyesno45+whiteMontgomery['lord', 'forgive', 'pronoun', 'pronoun', 'don...10+lord forgive pronoun pronoun dont know what pr...
..................................................................
561thirty+unknownthirty+otherunknownonemurder_othergungunyes...noyesnoyes45+whiteLubbock['i', 'pray', 'that', 'first_person_pronoun', ...10+i pray that first_person_pronoun family will r...
562thirty+unknownthirty+otheryesonemurder_othergungunno...noyesnoyes35-45whiteBell['when', 'asked', 'if', 'pronoun', 'had', 'a',...10_or_lesswhen asked if pronoun had a last statement pro...
563thirty+unknownthirty+othernoonemurderotherotherno...yesyesnono35-45whiteHarris['what', 'is', 'about', 'to', 'transpire', 'in...10_or_lesswhat is about to transpire in a few moments is...
564twentiesno_highschooltwentieslaboreryestwo+murdergungunyes...noyesyesno18-34whiteJefferson['none']10_or_lessnone
565thirty+highschoolthirty+laboreryesonemurder_robberygungunyes...noyesnono35-45blackTarrant['statement', 'to', 'the', 'media', 'first_per...10_or_lessstatement to the media first_person_pronoun at...
\n", "

566 rows × 21 columns

\n", "
" ], "text/plain": [ " age_received education_level age_crime occupation prior_record \\\n", "0 twenties some_highschool twenties laborer yes \n", "1 thirty+ no_highschool thirty+ other yes \n", "2 thirty+ no_highschool twenties other yes \n", "3 thirty+ some_highschool thirty+ laborer yes \n", "4 twenties some_highschool twenties laborer yes \n", ".. ... ... ... ... ... \n", "561 thirty+ unknown thirty+ other unknown \n", "562 thirty+ unknown thirty+ other yes \n", "563 thirty+ unknown thirty+ other no \n", "564 twenties no_highschool twenties laborer yes \n", "565 thirty+ highschool thirty+ laborer yes \n", "\n", " num_of_vic main_crime type_of_crime weapon co_defendants ... \\\n", "0 one murder other other no ... \n", "1 two+ murder other knife no ... \n", "2 one murder_robbery gun gun yes ... \n", "3 two+ murder other knife no ... \n", "4 one murder_other other other no ... \n", ".. ... ... ... ... ... ... \n", "561 one murder_other gun gun yes ... \n", "562 one murder_other gun gun no ... \n", "563 one murder other other no ... \n", "564 two+ murder gun gun yes ... \n", "565 one murder_robbery gun gun yes ... \n", "\n", " vic_kid vic_male vic_female vic_police age race county \\\n", "0 no no yes no 35-45 white El Paso \n", "1 yes yes yes no 35-45 black Dallas \n", "2 no no yes no 35-45 hispanic Johnson \n", "3 no no yes no 45+ white Tarrant \n", "4 no no yes no 45+ white Montgomery \n", ".. ... ... ... ... ... ... ... \n", "561 no yes no yes 45+ white Lubbock \n", "562 no yes no yes 35-45 white Bell \n", "563 yes yes no no 35-45 white Harris \n", "564 no yes yes no 18-34 white Jefferson \n", "565 no yes no no 35-45 black Tarrant \n", "\n", " last_statement time_spent \\\n", "0 ['yeah', 'first_person_pronoun', 'want', 'to',... 10+ \n", "1 ['umm', 'pamela', 'can', 'pronoun', 'hear', 'f... 10+ \n", "2 ['its', 'on', 'september', 'th', 'kayla', 'and... 10_or_less \n", "3 ['hi', 'ladies', 'first_person_pronoun', 'want... 10+ \n", "4 ['lord', 'forgive', 'pronoun', 'pronoun', 'don... 10+ \n", ".. ... ... \n", "561 ['i', 'pray', 'that', 'first_person_pronoun', ... 10+ \n", "562 ['when', 'asked', 'if', 'pronoun', 'had', 'a',... 10_or_less \n", "563 ['what', 'is', 'about', 'to', 'transpire', 'in... 10_or_less \n", "564 ['none'] 10_or_less \n", "565 ['statement', 'to', 'the', 'media', 'first_per... 10_or_less \n", "\n", " statement_string \n", "0 yeah first_person_pronoun want to address the ... \n", "1 umm pamela can pronoun hear first_person_prono... \n", "2 its on september th kayla and david first_pers... \n", "3 hi ladies first_person_pronoun wanted to tell ... \n", "4 lord forgive pronoun pronoun dont know what pr... \n", ".. ... \n", "561 i pray that first_person_pronoun family will r... \n", "562 when asked if pronoun had a last statement pro... \n", "563 what is about to transpire in a few moments is... \n", "564 none \n", "565 statement to the media first_person_pronoun at... \n", "\n", "[566 rows x 21 columns]" ] }, "execution_count": 29, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df" ] }, { "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 }