Upload date-conversion.ipynb
Browse files- date-conversion.ipynb +54 -0
date-conversion.ipynb
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "code",
|
| 5 |
+
"execution_count": 3,
|
| 6 |
+
"id": "b42faeb2",
|
| 7 |
+
"metadata": {},
|
| 8 |
+
"outputs": [],
|
| 9 |
+
"source": [
|
| 10 |
+
"import pandas as pd\n",
|
| 11 |
+
"\n",
|
| 12 |
+
"df = pd.read_csv('data/distilbert-usa.csv', low_memory=False)\n",
|
| 13 |
+
"\n",
|
| 14 |
+
"df['Created At'] = pd.to_datetime(df['Created At'], errors='coerce')\n",
|
| 15 |
+
"# remove rows where 'Created At' is NaT\n",
|
| 16 |
+
"df = df.dropna(subset=['Created At'])\n",
|
| 17 |
+
"\n",
|
| 18 |
+
"df['Month_Year'] = df['Created At'].dt.strftime('%m/%Y')\n",
|
| 19 |
+
"df.head()\n",
|
| 20 |
+
"\n",
|
| 21 |
+
"df.to_csv('data/distilbert-usa.csv', index=False)"
|
| 22 |
+
]
|
| 23 |
+
},
|
| 24 |
+
{
|
| 25 |
+
"cell_type": "code",
|
| 26 |
+
"execution_count": null,
|
| 27 |
+
"id": "829d418b",
|
| 28 |
+
"metadata": {},
|
| 29 |
+
"outputs": [],
|
| 30 |
+
"source": []
|
| 31 |
+
}
|
| 32 |
+
],
|
| 33 |
+
"metadata": {
|
| 34 |
+
"kernelspec": {
|
| 35 |
+
"display_name": "Python 3 (ipykernel)",
|
| 36 |
+
"language": "python",
|
| 37 |
+
"name": "python3"
|
| 38 |
+
},
|
| 39 |
+
"language_info": {
|
| 40 |
+
"codemirror_mode": {
|
| 41 |
+
"name": "ipython",
|
| 42 |
+
"version": 3
|
| 43 |
+
},
|
| 44 |
+
"file_extension": ".py",
|
| 45 |
+
"mimetype": "text/x-python",
|
| 46 |
+
"name": "python",
|
| 47 |
+
"nbconvert_exporter": "python",
|
| 48 |
+
"pygments_lexer": "ipython3",
|
| 49 |
+
"version": "3.11.4"
|
| 50 |
+
}
|
| 51 |
+
},
|
| 52 |
+
"nbformat": 4,
|
| 53 |
+
"nbformat_minor": 5
|
| 54 |
+
}
|