{ "cells": [ { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "\n", "# col_names = [\"region\",\"video_id\", \"timeFetched\", \"title\", \"channel_title\", \"category_id\", \"publish_time\", \"tags\", \"views\", \"likes\",\"dislikes\", \"comment_count\", \"thumbnail_link\", \"comments_disabled\", \"ratings_disabled\", \"video_error_or_removed\", \"description\"]\n", "# data = pd.read_csv(\"combinedNewOld.csv\", names=col_names)\n", "data = pd.read_csv(\"oldAndNewData.csv\", engine='python')" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "def del_Rows(data):\n", " \n", " rows = len(data)\n", " #titleInd = \n", " for i in range(rows): #iterates through every row in data \n", " s = str(data.loc[i]['videoTitle']) #converts the title to a string\n", " if (not(s.isascii())):\n", " data.drop(i, axis = 0, inplace = True) #if not english, that row is deleted\n", " \n", " #return data.to_csv(\"MODIFIED.csv\", sep=str(','))\n", " return data.to_csv(\"oldAndNewOnlyEnglish.csv\", index = False)\n", " " ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [], "source": [ "del_Rows(data)" ] } ], "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.5" } }, "nbformat": 4, "nbformat_minor": 4 }