Skip to content

Commit

Permalink
move kaggle dataset into new folder structure (ourownstory#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
noxan authored Dec 4, 2022
1 parent e1f5aab commit c8676d1
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 391 deletions.
File renamed without changes.
File renamed without changes.
87 changes: 87 additions & 0 deletions kaggle-energy/preprocessing/kaggle-energy-preprocessing.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"df = pd.read_csv(\"../datasets_raw/energy/kaggle-energy-consumption-generation/energy_dataset.csv\")\n",
"df.head()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Select only the columns we need\n",
"df = df[[\"time\", \"price actual\"]]\n",
"\n",
"# Drop NaN values\n",
"df = df[[\"time\", \"price actual\"]].dropna()\n",
"\n",
"# Rename columns ds and y\n",
"df = df.rename(columns={\"time\": \"ds\", \"price actual\": \"y\"})\n",
"\n",
"# Convert to datetime\n",
"df[\"ds\"] = pd.to_datetime(df[\"ds\"], utc=True).dt.tz_localize(None)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"df.head()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"df.to_csv(\"../datasets/kaggle-energy/tutorial01.csv\", index=False)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.10.8 64-bit",
"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.10.8"
},
"orig_nbformat": 4,
"vscode": {
"interpreter": {
"hash": "949777d72b0d2535278d3dc13498b2535136f6dfe0678499012e853ee9abcab1"
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Loading

0 comments on commit c8676d1

Please sign in to comment.