PriceForecast/Untitled.ipynb

183 lines
5.3 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"cells": [
{
"cell_type": "code",
"execution_count": 3,
"id": "9048d286-415f-4a33-be3a-9d7099aa85de",
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"from config_jingbo import *"
]
},
{
"cell_type": "code",
"execution_count": 19,
"id": "07e338e7-1dd1-417f-b4e2-65d0efc983d6",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 33,
"id": "659eec10-f0b8-4d65-b70e-6f07f45291bc",
"metadata": {},
"outputs": [],
"source": [
"y_last_update_time = df[df['feature']=='y']['warning_date'].values[0]\n"
]
},
{
"cell_type": "code",
"execution_count": 49,
"id": "31035e6f-36e8-4b17-a14b-f7dd79ae085a",
"metadata": {},
"outputs": [
{
"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>last_update_time</th>\n",
" <th>feature</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>500</th>\n",
" <td>2024-11-14</td>\n",
" <td>lmcads03 lme comdty</td>\n",
" </tr>\n",
" <tr>\n",
" <th>251</th>\n",
" <td>2024-11-14</td>\n",
" <td>美国MEH轻原油现货价格美湾</td>\n",
" </tr>\n",
" <tr>\n",
" <th>231</th>\n",
" <td>2024-11-14</td>\n",
" <td>WTI原油Cushing-C1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>264</th>\n",
" <td>2024-11-14</td>\n",
" <td>LLS原油现货价格</td>\n",
" </tr>\n",
" <tr>\n",
" <th>82</th>\n",
" <td>2024-11-14</td>\n",
" <td>OMAN原油中质远期现货DES价山东</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>83</th>\n",
" <td>2023-01-03</td>\n",
" <td>PVM Dubai EFS/Swap vs ICE First Month Brent</td>\n",
" </tr>\n",
" <tr>\n",
" <th>91</th>\n",
" <td>2022-11-16</td>\n",
" <td>Brent/迪拜原油升贴水</td>\n",
" </tr>\n",
" <tr>\n",
" <th>94</th>\n",
" <td>2022-01-31</td>\n",
" <td>W-B活跃合约价差</td>\n",
" </tr>\n",
" <tr>\n",
" <th>95</th>\n",
" <td>2022-01-31</td>\n",
" <td>B-W活跃合约价差</td>\n",
" </tr>\n",
" <tr>\n",
" <th>31</th>\n",
" <td>2018-10-24</td>\n",
" <td>西北欧即期Brent 211利润</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>73 rows × 2 columns</p>\n",
"</div>"
],
"text/plain": [
" last_update_time feature\n",
"500 2024-11-14 lmcads03 lme comdty\n",
"251 2024-11-14 美国MEH轻原油现货价格美湾\n",
"231 2024-11-14 WTI原油Cushing-C1\n",
"264 2024-11-14 LLS原油现货价格\n",
"82 2024-11-14 OMAN原油中质远期现货DES价山东\n",
".. ... ...\n",
"83 2023-01-03 PVM Dubai EFS/Swap vs ICE First Month Brent\n",
"91 2022-11-16 Brent/迪拜原油升贴水\n",
"94 2022-01-31 W-B活跃合约价差\n",
"95 2022-01-31 B-W活跃合约价差\n",
"31 2018-10-24 西北欧即期Brent 211利润\n",
"\n",
"[73 rows x 2 columns]"
]
},
"execution_count": 49,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df[df['warning_date']<y_last_update_time][['last_update_time','feature']]"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "937a9adb-1652-4d6b-a5c7-828d7c17769d",
"metadata": {},
"outputs": [],
"source": [
"df2 = pd.read_csv(os.path.join(dataset,''))"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"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.11.7"
}
},
"nbformat": 4,
"nbformat_minor": 5
}