{ "cells": [ { "cell_type": "markdown", "source": [], "metadata": { "collapsed": false }, "id": "1d78bbcc6a4392cd" }, { "cell_type": "markdown", "source": [ "## Importing the libraries" ], "metadata": { "collapsed": false }, "id": "93d70c03bd59ccaf" }, { "cell_type": "code", "execution_count": 1, "id": "initial_id", "metadata": { "collapsed": true, "ExecuteTime": { "end_time": "2024-06-02T14:20:41.289105Z", "start_time": "2024-06-02T14:20:38.108557Z" } }, "outputs": [], "source": [ "from sklearn.model_selection import train_test_split\n", "import pandas as pd\n", "import matplotlib.pyplot as plt" ] }, { "cell_type": "markdown", "source": [ "## Importing the dataset" ], "metadata": { "collapsed": false }, "id": "e004f72e190b83ac" }, { "cell_type": "code", "outputs": [], "source": [ "dataset = pd.read_csv('EconomyNextAllNews_with_sentiments.csv')" ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2024-06-02T14:20:41.402394Z", "start_time": "2024-06-02T14:20:41.291113Z" } }, "id": "87518dc389f0607f", "execution_count": 2 }, { "cell_type": "code", "outputs": [], "source": [ "dataset['sentiment_score'] = dataset['sentiment_score'].round()" ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2024-06-02T14:20:41.408006Z", "start_time": "2024-06-02T14:20:41.403403Z" } }, "id": "8eed951376f031ca", "execution_count": 3 }, { "cell_type": "code", "outputs": [ { "data": { "text/plain": "Headline 0\nDate 0\nIndustry 0\nNews Description 0\ncombined_text 0\nsentiment 0\nsentiment_score 0\ndtype: int64" }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dataset.isnull().sum()" ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2024-06-02T14:20:41.427507Z", "start_time": "2024-06-02T14:20:41.409016Z" } }, "id": "c6f146a3d696d7a6", "execution_count": 4 }, { "cell_type": "code", "outputs": [ { "data": { "text/plain": " Headline Date \\\n0 Sri Lanka needs energy transition law so priva... 2024-05-30 \n1 Singapore team to help improve Sri Lanka immig... 2024-05-30 \n2 Sri Lanka tourists to get 60-day visa free ent... 2024-05-30 \n3 Reyaz Mihular chairman of Sri Lanka's Watawala... 2024-05-30 \n4 Sri Lanka rupee opens lower at 301.60/75 to US... 2024-05-30 \n\n Industry News Description \\\n0 Energy Enhance institutional capacity, regulatory fra... \n1 Economy Will facilitate Sri Lanka's efforts to moderni... \n2 International Relations The visa will also allow foreign students of h... \n3 Agriculture Mihular, a chartered accountant, appointed cha... \n4 Bonds & Forex Bond yields were steady. \n\n combined_text sentiment \\\n0 Sri Lanka needs energy transition law so priva... positive \n1 Singapore team to help improve Sri Lanka immig... positive \n2 Sri Lanka tourists to get 60-day visa free ent... positive \n3 Reyaz Mihular chairman of Sri Lanka's Watawala... positive \n4 Sri Lanka rupee opens lower at 301.60/75 to US... positive \n\n sentiment_score \n0 1.0 \n1 1.0 \n2 1.0 \n3 1.0 \n4 1.0 ", "text/html": "
\n | Headline | \nDate | \nIndustry | \nNews Description | \ncombined_text | \nsentiment | \nsentiment_score | \n
---|---|---|---|---|---|---|---|
0 | \nSri Lanka needs energy transition law so priva... | \n2024-05-30 | \nEnergy | \nEnhance institutional capacity, regulatory fra... | \nSri Lanka needs energy transition law so priva... | \npositive | \n1.0 | \n
1 | \nSingapore team to help improve Sri Lanka immig... | \n2024-05-30 | \nEconomy | \nWill facilitate Sri Lanka's efforts to moderni... | \nSingapore team to help improve Sri Lanka immig... | \npositive | \n1.0 | \n
2 | \nSri Lanka tourists to get 60-day visa free ent... | \n2024-05-30 | \nInternational Relations | \nThe visa will also allow foreign students of h... | \nSri Lanka tourists to get 60-day visa free ent... | \npositive | \n1.0 | \n
3 | \nReyaz Mihular chairman of Sri Lanka's Watawala... | \n2024-05-30 | \nAgriculture | \nMihular, a chartered accountant, appointed cha... | \nReyaz Mihular chairman of Sri Lanka's Watawala... | \npositive | \n1.0 | \n
4 | \nSri Lanka rupee opens lower at 301.60/75 to US... | \n2024-05-30 | \nBonds & Forex | \nBond yields were steady. | \nSri Lanka rupee opens lower at 301.60/75 to US... | \npositive | \n1.0 | \n