Skip to content

Instantly share code, notes, and snippets.

@BarisSari
Last active December 24, 2020 09:47
Show Gist options
  • Save BarisSari/ba994977a48c705293b7d81d6550b65a to your computer and use it in GitHub Desktop.
Save BarisSari/ba994977a48c705293b7d81d6550b65a to your computer and use it in GitHub Desktop.
read-csv.ipynb
Display the source blob
Display the rendered blob
Raw
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "sentence-tokenization.ipynb",
"provenance": [],
"collapsed_sections": [],
"authorship_tag": "ABX9TyM+qIFoFb66iZq5bupF1Ip6",
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/gist/BarisSari/ba994977a48c705293b7d81d6550b65a/sentence-tokenization.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "eJJrXlJID1bg",
"outputId": "0ab6382d-7040-47dd-863e-52214848e91a"
},
"source": [
"import pandas as pd\n",
"\n",
"# Read the file\n",
"df = pd.read_csv(FILE_PATH)\n",
"# Assign first_dialogue to the first row's \"Dialogue\" column\n",
"first_dialogue = df.loc[0, \"Dialogue\"]\n",
"print(first_dialogue)"
],
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"text": [
"Do you know what this is all about? Do you know, why were here? To be out, this is out...and out is one of the single most enjoyable experiences of life. People...did you ever hear people talking about We should go out? This is what theyre talking about...this whole thing, were all out now, no one is home. Not one person here is home, were all out! There are people tryin to find us, they dont know where we are. (on an imaginary phone) Did you ring?, I cant find him. Where did he go? He didnt tell me where he was going. He must have gone out. You wanna go out you get ready, you pick out the clothes, right? You take the shower, you get all ready, get the cash, get your friends, the car, the spot, the reservation...Then youre standing around, whatta you do? You go We gotta be getting back. Once youre out, you wanna get back! You wanna go to sleep, you wanna get up, you wanna go out again tomorrow, right? Where ever you are in life, its my feeling, youve gotta go.\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 204
},
"id": "HmqACyrSD5-f",
"outputId": "00ee2edb-c57e-4f23-87c8-d364c09696cf"
},
"source": [
"df.head()"
],
"execution_count": null,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Unnamed: 0</th>\n",
" <th>Character</th>\n",
" <th>Dialogue</th>\n",
" <th>EpisodeNo</th>\n",
" <th>SEID</th>\n",
" <th>Season</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>0</td>\n",
" <td>JERRY</td>\n",
" <td>Do you know what this is all about? Do you kno...</td>\n",
" <td>1.0</td>\n",
" <td>S01E01</td>\n",
" <td>1.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>1</td>\n",
" <td>JERRY</td>\n",
" <td>(pointing at Georges shirt) See, to me, that b...</td>\n",
" <td>1.0</td>\n",
" <td>S01E01</td>\n",
" <td>1.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>2</td>\n",
" <td>GEORGE</td>\n",
" <td>Are you through?</td>\n",
" <td>1.0</td>\n",
" <td>S01E01</td>\n",
" <td>1.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>3</td>\n",
" <td>JERRY</td>\n",
" <td>You do of course try on, when you buy?</td>\n",
" <td>1.0</td>\n",
" <td>S01E01</td>\n",
" <td>1.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>4</td>\n",
" <td>GEORGE</td>\n",
" <td>Yes, it was purple, I liked it, I dont actuall...</td>\n",
" <td>1.0</td>\n",
" <td>S01E01</td>\n",
" <td>1.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Unnamed: 0 Character ... SEID Season\n",
"0 0 JERRY ... S01E01 1.0\n",
"1 1 JERRY ... S01E01 1.0\n",
"2 2 GEORGE ... S01E01 1.0\n",
"3 3 JERRY ... S01E01 1.0\n",
"4 4 GEORGE ... S01E01 1.0\n",
"\n",
"[5 rows x 6 columns]"
]
},
"metadata": {
"tags": []
},
"execution_count": 49
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment