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