{ "cells": [ { "cell_type": "code", "execution_count": 1, "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", "
Unnamed: 0bodyheadlineupdatedDatetopic_predictiontopic_verificationnegative_scoreneutral_scorepositive_scoretrend_predictiontrend_verification
00Spanish crude import volumes increased 11% ye...SPAIN DATA: H1 crude imports rise 11% to 1.4 m...2024-08-08 12:11:55+00:00Crude OilCrude Oil0.9914730.0055240.519264BearishBearish
11A number of refineries in China have resumed ...REFINERY NEWS: Host of Chinese units back from...2024-08-08 11:51:12+00:00Macroeconomic & GeopoliticsMacroeconomic & Geopolitics0.4170540.8455950.180685NeutralNeutral
22Some refineries in the Asia-Pacific region in...REFINERY NEWS ROUNDUP: Mixed runs in Asia-Pacific2024-08-08 11:50:48+00:00Macroeconomic & GeopoliticsMacroeconomic & Geopolitics0.2687080.0445040.992063BullishBullish
33The physical low sulfur (1%S) fuel oil Med-No...Physical 1%S fuel oil Med-North spread hits re...2024-08-08 11:28:20+00:00Middle DistillatesMiddle Distillates0.9519850.0096130.822905BearishBearish
44Bunkering activity in India has experienced s...Indian ports see Jan-July bunker, STS calls up...2024-08-08 11:27:15+00:00Heavy DistillatesHeavy Distillates0.0988440.0593480.997325BullishBullish
....................................
153367The Asian middle distillates complex could be...ASIA MIDDLE DISTILLATES: Key market indicators...2024-08-05 01:50:17+00:00Middle DistillatesMiddle Distillates0.0349320.3108550.993474BullishBullish
154368The combined open interest for front-month Si...ICE front-month Singapore HSFO open interest r...2024-08-05 01:26:07+00:00Heavy DistillatesHeavy Distillates0.3680890.0174830.994805BullishBullish
155369Production will be increasing “in the near fu...REFINERY NEWS: Fort Energy at Fujairah ‘remain...2024-08-05 00:45:56+00:00Macroeconomic & GeopoliticsMacroeconomic & Geopolitics0.7759530.5201160.177664BearishBearish
156370Container ship Groton was attacked 125 nautic...Container ship Groton attacked near Yemen amid...2024-08-04 12:25:30+00:00Macroeconomic & GeopoliticsMacroeconomic & Geopolitics0.2455940.0446710.994086BullishBullish
157371A drone strike on an oil depot in Russia’s Be...Oil depot in Russia’s Belgorod region hit by d...2024-08-04 10:14:50+00:00Macroeconomic & GeopoliticsMacroeconomic & Geopolitics0.2439010.9511990.129076NeutralNeutral
\n", "

158 rows × 11 columns

\n", "
" ], "text/plain": [ " Unnamed: 0 body \\\n", "0 0 Spanish crude import volumes increased 11% ye... \n", "1 1 A number of refineries in China have resumed ... \n", "2 2 Some refineries in the Asia-Pacific region in... \n", "3 3 The physical low sulfur (1%S) fuel oil Med-No... \n", "4 4 Bunkering activity in India has experienced s... \n", ".. ... ... \n", "153 367 The Asian middle distillates complex could be... \n", "154 368 The combined open interest for front-month Si... \n", "155 369 Production will be increasing “in the near fu... \n", "156 370 Container ship Groton was attacked 125 nautic... \n", "157 371 A drone strike on an oil depot in Russia’s Be... \n", "\n", " headline \\\n", "0 SPAIN DATA: H1 crude imports rise 11% to 1.4 m... \n", "1 REFINERY NEWS: Host of Chinese units back from... \n", "2 REFINERY NEWS ROUNDUP: Mixed runs in Asia-Pacific \n", "3 Physical 1%S fuel oil Med-North spread hits re... \n", "4 Indian ports see Jan-July bunker, STS calls up... \n", ".. ... \n", "153 ASIA MIDDLE DISTILLATES: Key market indicators... \n", "154 ICE front-month Singapore HSFO open interest r... \n", "155 REFINERY NEWS: Fort Energy at Fujairah ‘remain... \n", "156 Container ship Groton attacked near Yemen amid... \n", "157 Oil depot in Russia’s Belgorod region hit by d... \n", "\n", " updatedDate topic_prediction \\\n", "0 2024-08-08 12:11:55+00:00 Crude Oil \n", "1 2024-08-08 11:51:12+00:00 Macroeconomic & Geopolitics \n", "2 2024-08-08 11:50:48+00:00 Macroeconomic & Geopolitics \n", "3 2024-08-08 11:28:20+00:00 Middle Distillates \n", "4 2024-08-08 11:27:15+00:00 Heavy Distillates \n", ".. ... ... \n", "153 2024-08-05 01:50:17+00:00 Middle Distillates \n", "154 2024-08-05 01:26:07+00:00 Heavy Distillates \n", "155 2024-08-05 00:45:56+00:00 Macroeconomic & Geopolitics \n", "156 2024-08-04 12:25:30+00:00 Macroeconomic & Geopolitics \n", "157 2024-08-04 10:14:50+00:00 Macroeconomic & Geopolitics \n", "\n", " topic_verification negative_score neutral_score \\\n", "0 Crude Oil 0.991473 0.005524 \n", "1 Macroeconomic & Geopolitics 0.417054 0.845595 \n", "2 Macroeconomic & Geopolitics 0.268708 0.044504 \n", "3 Middle Distillates 0.951985 0.009613 \n", "4 Heavy Distillates 0.098844 0.059348 \n", ".. ... ... ... \n", "153 Middle Distillates 0.034932 0.310855 \n", "154 Heavy Distillates 0.368089 0.017483 \n", "155 Macroeconomic & Geopolitics 0.775953 0.520116 \n", "156 Macroeconomic & Geopolitics 0.245594 0.044671 \n", "157 Macroeconomic & Geopolitics 0.243901 0.951199 \n", "\n", " positive_score trend_prediction trend_verification \n", "0 0.519264 Bearish Bearish \n", "1 0.180685 Neutral Neutral \n", "2 0.992063 Bullish Bullish \n", "3 0.822905 Bearish Bearish \n", "4 0.997325 Bullish Bullish \n", ".. ... ... ... \n", "153 0.993474 Bullish Bullish \n", "154 0.994805 Bullish Bullish \n", "155 0.177664 Bearish Bearish \n", "156 0.994086 Bullish Bullish \n", "157 0.129076 Neutral Neutral \n", "\n", "[158 rows x 11 columns]" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import pandas as pd\n", "import os\n", "\n", "test = pd.read_csv(os.path.join('data','all_platts_1week_clean.csv'))\n", "test" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "test.to_excel('evaluation.xlsx')" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [], "source": [ "train = test.drop(columns=['Unnamed: 0', 'body', 'updatedDate', 'topic_prediction', 'negative_score', 'neutral_score', 'positive_score', 'trend_prediction', 'trend_verification'])" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [], "source": [ "train.to_csv('convert_first.csv')" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [], "source": [ "dated_brent = pd.read_csv('data/dated_brent_allbate.csv')" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [], "source": [ "dated_brent = dated_brent[dated_brent['assessDate'] >= '2024-08-04']\n", "dated_brent = dated_brent[dated_brent['bate']=='c']" ] }, { "cell_type": "code", "execution_count": 14, "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", "
Unnamed: 0batevalueassessDateisCorrectedmodDatesymbol
80198019c76.7002024-08-05N2024-08-05 17:55:34PCAAS00
80228022c76.2752024-08-06N2024-08-06 17:48:25PCAAS00
80258025c79.9102024-08-07N2024-08-07 19:01:31PCAAS00
80288028c81.1002024-08-08N2024-08-08 18:15:44PCAAS00
80318031c81.6152024-08-09N2024-08-09 18:00:52PCAAS00
\n", "
" ], "text/plain": [ " Unnamed: 0 bate value assessDate isCorrected modDate \\\n", "8019 8019 c 76.700 2024-08-05 N 2024-08-05 17:55:34 \n", "8022 8022 c 76.275 2024-08-06 N 2024-08-06 17:48:25 \n", "8025 8025 c 79.910 2024-08-07 N 2024-08-07 19:01:31 \n", "8028 8028 c 81.100 2024-08-08 N 2024-08-08 18:15:44 \n", "8031 8031 c 81.615 2024-08-09 N 2024-08-09 18:00:52 \n", "\n", " symbol \n", "8019 PCAAS00 \n", "8022 PCAAS00 \n", "8025 PCAAS00 \n", "8028 PCAAS00 \n", "8031 PCAAS00 " ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dated_brent" ] }, { "cell_type": "code", "execution_count": 1, "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", "
Unnamed: 0bodyheadlineupdatedDatetopic_predictiontopic_verificationnegative_scoreneutral_scorepositive_scoretrend_predictiontrend_verificationUnnamed: 11Price DataUnnamed: 13Unnamed: 14Bearish PredictionNeutral PredictionBullish PredictionPrediction (All News)
00Spanish crude import volumes increased 11% ye...SPAIN DATA: H1 crude imports rise 11% to 1.4 m...2024-08-08 12:11:55+00:00Crude OilCrude Oil0.9914730.0055240.519264BearishBearishNaN2024-08-0576.7NaN0.5755910.1833410.748952Bullish
11A number of refineries in China have resumed ...REFINERY NEWS: Host of Chinese units back from...2024-08-08 11:51:12+00:00Macroeconomic & GeopoliticsMacroeconomic & Geopolitics0.4170540.8455950.180685NeutralNeutralNaN2024-08-0676.275NaN0.6534130.1374360.672831Bullish
22Some refineries in the Asia-Pacific region in...REFINERY NEWS ROUNDUP: Mixed runs in Asia-Pacific2024-08-08 11:50:48+00:00Macroeconomic & GeopoliticsMacroeconomic & Geopolitics0.2687080.0445040.992063BullishBullishNaN2024-08-0779.91NaN0.6535860.0962580.727852Bullish
33The physical low sulfur (1%S) fuel oil Med-No...Physical 1%S fuel oil Med-North spread hits re...2024-08-08 11:28:20+00:00Middle DistillatesMiddle Distillates0.9519850.0096130.822905BearishBearishNaN2024-08-0881.1NaN0.4991590.2093260.750482Bullish
44Bunkering activity in India has experienced s...Indian ports see Jan-July bunker, STS calls up...2024-08-08 11:27:15+00:00Heavy DistillatesHeavy Distillates0.0988440.0593480.997325BullishBullishNaN2024-08-0981.615NaNNaNNaNNaNNaN
............................................................
136136Saudi Aramco maintained or raised the Asia-bo...Saudi Aramco maintains or raises Asia-bound Se...2024-08-05 01:59:16+00:00Crude OilCrude Oil0.1546420.0326330.997273BullishBullishNaNNaTNaNNaNNaNNaNNaNNaN
137137The combined open interest for front-month Si...ICE front-month Singapore HSFO open interest r...2024-08-05 01:26:07+00:00Heavy DistillatesHeavy Distillates0.3680890.0174830.994805BullishBullishNaNNaTNaNNaNNaNNaNNaNNaN
138138Production will be increasing “in the near fu...REFINERY NEWS: Fort Energy at Fujairah ‘remain...2024-08-05 00:45:56+00:00Macroeconomic & GeopoliticsMacroeconomic & Geopolitics0.7759530.5201160.177664BearishBearishNaNNaTNaNNaNNaNNaNNaNNaN
139139Container ship Groton was attacked 125 nautic...Container ship Groton attacked near Yemen amid...2024-08-04 12:25:30+00:00Macroeconomic & GeopoliticsMacroeconomic & Geopolitics0.2455940.0446710.994086BullishBullishNaNNaTNaNNaNNaNNaNNaNNaN
140140A drone strike on an oil depot in Russia’s Be...Oil depot in Russia’s Belgorod region hit by d...2024-08-04 10:14:50+00:00Macroeconomic & GeopoliticsMacroeconomic & Geopolitics0.2439010.9511990.129076NeutralNeutralNaNNaTNaNNaNNaNNaNNaNNaN
\n", "

141 rows × 19 columns

\n", "
" ], "text/plain": [ " Unnamed: 0 body \\\n", "0 0 Spanish crude import volumes increased 11% ye... \n", "1 1 A number of refineries in China have resumed ... \n", "2 2 Some refineries in the Asia-Pacific region in... \n", "3 3 The physical low sulfur (1%S) fuel oil Med-No... \n", "4 4 Bunkering activity in India has experienced s... \n", ".. ... ... \n", "136 136 Saudi Aramco maintained or raised the Asia-bo... \n", "137 137 The combined open interest for front-month Si... \n", "138 138 Production will be increasing “in the near fu... \n", "139 139 Container ship Groton was attacked 125 nautic... \n", "140 140 A drone strike on an oil depot in Russia’s Be... \n", "\n", " headline \\\n", "0 SPAIN DATA: H1 crude imports rise 11% to 1.4 m... \n", "1 REFINERY NEWS: Host of Chinese units back from... \n", "2 REFINERY NEWS ROUNDUP: Mixed runs in Asia-Pacific \n", "3 Physical 1%S fuel oil Med-North spread hits re... \n", "4 Indian ports see Jan-July bunker, STS calls up... \n", ".. ... \n", "136 Saudi Aramco maintains or raises Asia-bound Se... \n", "137 ICE front-month Singapore HSFO open interest r... \n", "138 REFINERY NEWS: Fort Energy at Fujairah ‘remain... \n", "139 Container ship Groton attacked near Yemen amid... \n", "140 Oil depot in Russia’s Belgorod region hit by d... \n", "\n", " updatedDate topic_prediction \\\n", "0 2024-08-08 12:11:55+00:00 Crude Oil \n", "1 2024-08-08 11:51:12+00:00 Macroeconomic & Geopolitics \n", "2 2024-08-08 11:50:48+00:00 Macroeconomic & Geopolitics \n", "3 2024-08-08 11:28:20+00:00 Middle Distillates \n", "4 2024-08-08 11:27:15+00:00 Heavy Distillates \n", ".. ... ... \n", "136 2024-08-05 01:59:16+00:00 Crude Oil \n", "137 2024-08-05 01:26:07+00:00 Heavy Distillates \n", "138 2024-08-05 00:45:56+00:00 Macroeconomic & Geopolitics \n", "139 2024-08-04 12:25:30+00:00 Macroeconomic & Geopolitics \n", "140 2024-08-04 10:14:50+00:00 Macroeconomic & Geopolitics \n", "\n", " topic_verification negative_score neutral_score \\\n", "0 Crude Oil 0.991473 0.005524 \n", "1 Macroeconomic & Geopolitics 0.417054 0.845595 \n", "2 Macroeconomic & Geopolitics 0.268708 0.044504 \n", "3 Middle Distillates 0.951985 0.009613 \n", "4 Heavy Distillates 0.098844 0.059348 \n", ".. ... ... ... \n", "136 Crude Oil 0.154642 0.032633 \n", "137 Heavy Distillates 0.368089 0.017483 \n", "138 Macroeconomic & Geopolitics 0.775953 0.520116 \n", "139 Macroeconomic & Geopolitics 0.245594 0.044671 \n", "140 Macroeconomic & Geopolitics 0.243901 0.951199 \n", "\n", " positive_score trend_prediction trend_verification Unnamed: 11 \\\n", "0 0.519264 Bearish Bearish NaN \n", "1 0.180685 Neutral Neutral NaN \n", "2 0.992063 Bullish Bullish NaN \n", "3 0.822905 Bearish Bearish NaN \n", "4 0.997325 Bullish Bullish NaN \n", ".. ... ... ... ... \n", "136 0.997273 Bullish Bullish NaN \n", "137 0.994805 Bullish Bullish NaN \n", "138 0.177664 Bearish Bearish NaN \n", "139 0.994086 Bullish Bullish NaN \n", "140 0.129076 Neutral Neutral NaN \n", "\n", " Price Data Unnamed: 13 Unnamed: 14 Bearish Prediction \\\n", "0 2024-08-05 76.7 NaN 0.575591 \n", "1 2024-08-06 76.275 NaN 0.653413 \n", "2 2024-08-07 79.91 NaN 0.653586 \n", "3 2024-08-08 81.1 NaN 0.499159 \n", "4 2024-08-09 81.615 NaN NaN \n", ".. ... ... ... ... \n", "136 NaT NaN NaN NaN \n", "137 NaT NaN NaN NaN \n", "138 NaT NaN NaN NaN \n", "139 NaT NaN NaN NaN \n", "140 NaT NaN NaN NaN \n", "\n", " Neutral Prediction Bullish Prediction Prediction (All News) \n", "0 0.183341 0.748952 Bullish \n", "1 0.137436 0.672831 Bullish \n", "2 0.096258 0.727852 Bullish \n", "3 0.209326 0.750482 Bullish \n", "4 NaN NaN NaN \n", ".. ... ... ... \n", "136 NaN NaN NaN \n", "137 NaN NaN NaN \n", "138 NaN NaN NaN \n", "139 NaN NaN NaN \n", "140 NaN NaN NaN \n", "\n", "[141 rows x 19 columns]" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import pandas as pd\n", "eval = pd.read_excel('evaluation.xlsx')\n", "eval" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Bearish prediction 0.5093043801287273\n", " Neutral prediction 0.24558571118013772\n", " Bullish prediction 0.7223830104380737\n" ] } ], "source": [ "test = eval[(eval['topic_prediction']=='Macroeconomic & Geopolitics') | (eval['topic_prediction']=='Crude Oil')]\n", "test = test[test['updatedDate'].str.contains('2024-08-08')]\n", "print(f'Bearish prediction {test.negative_score.mean()}\\n Neutral prediction {test.neutral_score.mean()}\\n Bullish prediction {test.positive_score.mean()}')" ] }, { "cell_type": "code", "execution_count": 24, "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", "
bodyheadlineupdatedDatetopic_predictiontopic_verificationnegative_scoreneutral_scorepositive_scoretrend_prediction
0Spanish crude import volumes increased 11% ye...SPAIN DATA: H1 crude imports rise 11% to 1.4 m...2024-08-08 12:11:55+00:00Crude OilCrude Oil0.9914730.0055240.519264Bearish
1A number of refineries in China have resumed ...REFINERY NEWS: Host of Chinese units back from...2024-08-08 11:51:12+00:00Macroeconomic & GeopoliticsMacroeconomic & Geopolitics0.4170540.8455950.180685Neutral
2Some refineries in the Asia-Pacific region in...REFINERY NEWS ROUNDUP: Mixed runs in Asia-Pacific2024-08-08 11:50:48+00:00Macroeconomic & GeopoliticsMacroeconomic & Geopolitics0.2687080.0445040.992063Bullish
3The physical low sulfur (1%S) fuel oil Med-No...Physical 1%S fuel oil Med-North spread hits re...2024-08-08 11:28:20+00:00Middle DistillatesMiddle Distillates0.9519850.0096130.822905Bearish
4Bunkering activity in India has experienced s...Indian ports see Jan-July bunker, STS calls up...2024-08-08 11:27:15+00:00Heavy DistillatesHeavy Distillates0.0988440.0593480.997325Bullish
..............................
136Saudi Aramco maintained or raised the Asia-bo...Saudi Aramco maintains or raises Asia-bound Se...2024-08-05 01:59:16+00:00Crude OilCrude Oil0.1546420.0326330.997273Bullish
137The combined open interest for front-month Si...ICE front-month Singapore HSFO open interest r...2024-08-05 01:26:07+00:00Heavy DistillatesHeavy Distillates0.3680890.0174830.994805Bullish
138Production will be increasing “in the near fu...REFINERY NEWS: Fort Energy at Fujairah ‘remain...2024-08-05 00:45:56+00:00Macroeconomic & GeopoliticsMacroeconomic & Geopolitics0.7759530.5201160.177664Bearish
139Container ship Groton was attacked 125 nautic...Container ship Groton attacked near Yemen amid...2024-08-04 12:25:30+00:00Macroeconomic & GeopoliticsMacroeconomic & Geopolitics0.2455940.0446710.994086Bullish
140A drone strike on an oil depot in Russia’s Be...Oil depot in Russia’s Belgorod region hit by d...2024-08-04 10:14:50+00:00Macroeconomic & GeopoliticsMacroeconomic & Geopolitics0.2439010.9511990.129076Neutral
\n", "

141 rows × 9 columns

\n", "
" ], "text/plain": [ " body \\\n", "0 Spanish crude import volumes increased 11% ye... \n", "1 A number of refineries in China have resumed ... \n", "2 Some refineries in the Asia-Pacific region in... \n", "3 The physical low sulfur (1%S) fuel oil Med-No... \n", "4 Bunkering activity in India has experienced s... \n", ".. ... \n", "136 Saudi Aramco maintained or raised the Asia-bo... \n", "137 The combined open interest for front-month Si... \n", "138 Production will be increasing “in the near fu... \n", "139 Container ship Groton was attacked 125 nautic... \n", "140 A drone strike on an oil depot in Russia’s Be... \n", "\n", " headline \\\n", "0 SPAIN DATA: H1 crude imports rise 11% to 1.4 m... \n", "1 REFINERY NEWS: Host of Chinese units back from... \n", "2 REFINERY NEWS ROUNDUP: Mixed runs in Asia-Pacific \n", "3 Physical 1%S fuel oil Med-North spread hits re... \n", "4 Indian ports see Jan-July bunker, STS calls up... \n", ".. ... \n", "136 Saudi Aramco maintains or raises Asia-bound Se... \n", "137 ICE front-month Singapore HSFO open interest r... \n", "138 REFINERY NEWS: Fort Energy at Fujairah ‘remain... \n", "139 Container ship Groton attacked near Yemen amid... \n", "140 Oil depot in Russia’s Belgorod region hit by d... \n", "\n", " updatedDate topic_prediction \\\n", "0 2024-08-08 12:11:55+00:00 Crude Oil \n", "1 2024-08-08 11:51:12+00:00 Macroeconomic & Geopolitics \n", "2 2024-08-08 11:50:48+00:00 Macroeconomic & Geopolitics \n", "3 2024-08-08 11:28:20+00:00 Middle Distillates \n", "4 2024-08-08 11:27:15+00:00 Heavy Distillates \n", ".. ... ... \n", "136 2024-08-05 01:59:16+00:00 Crude Oil \n", "137 2024-08-05 01:26:07+00:00 Heavy Distillates \n", "138 2024-08-05 00:45:56+00:00 Macroeconomic & Geopolitics \n", "139 2024-08-04 12:25:30+00:00 Macroeconomic & Geopolitics \n", "140 2024-08-04 10:14:50+00:00 Macroeconomic & Geopolitics \n", "\n", " topic_verification negative_score neutral_score \\\n", "0 Crude Oil 0.991473 0.005524 \n", "1 Macroeconomic & Geopolitics 0.417054 0.845595 \n", "2 Macroeconomic & Geopolitics 0.268708 0.044504 \n", "3 Middle Distillates 0.951985 0.009613 \n", "4 Heavy Distillates 0.098844 0.059348 \n", ".. ... ... ... \n", "136 Crude Oil 0.154642 0.032633 \n", "137 Heavy Distillates 0.368089 0.017483 \n", "138 Macroeconomic & Geopolitics 0.775953 0.520116 \n", "139 Macroeconomic & Geopolitics 0.245594 0.044671 \n", "140 Macroeconomic & Geopolitics 0.243901 0.951199 \n", "\n", " positive_score trend_prediction \n", "0 0.519264 Bearish \n", "1 0.180685 Neutral \n", "2 0.992063 Bullish \n", "3 0.822905 Bearish \n", "4 0.997325 Bullish \n", ".. ... ... \n", "136 0.997273 Bullish \n", "137 0.994805 Bullish \n", "138 0.177664 Bearish \n", "139 0.994086 Bullish \n", "140 0.129076 Neutral \n", "\n", "[141 rows x 9 columns]" ] }, "execution_count": 24, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import pandas as pd\n", "import os\n", "\n", "test = pd.read_excel('evaluation.xlsx').drop(columns=['Unnamed: 0']).iloc[:, :9]\n", "\n", "test" ] }, { "cell_type": "code", "execution_count": 29, "metadata": {}, "outputs": [], "source": [ "test['updatedDate'] = pd.to_datetime(test['updatedDate'], format='%Y-%m-%d %H:%M:%S%z')" ] }, { "cell_type": "code", "execution_count": 30, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 141 entries, 0 to 140\n", "Data columns (total 9 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 body 141 non-null object \n", " 1 headline 141 non-null object \n", " 2 updatedDate 141 non-null datetime64[ns, UTC]\n", " 3 topic_prediction 141 non-null object \n", " 4 topic_verification 141 non-null object \n", " 5 negative_score 141 non-null float64 \n", " 6 neutral_score 141 non-null float64 \n", " 7 positive_score 141 non-null float64 \n", " 8 trend_prediction 141 non-null object \n", "dtypes: datetime64[ns, UTC](1), float64(3), object(5)\n", "memory usage: 10.0+ KB\n" ] } ], "source": [ "test.info()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from datetime import datetime\n", "import numpy as np\n", "\n", "test[test['updatedDate']>= datetime.strptime('2024-08-07 00:00:00+00:00', '%Y-%m-%d %H:%M:%S%z')]" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import datetime\n", "\n", "test_date = datetime(2024, 8, 4)" ] } ], "metadata": { "kernelspec": { "display_name": "rl", "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.9.18" } }, "nbformat": 4, "nbformat_minor": 2 }