File size: 1,180 Bytes
3df035a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "b42faeb2",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "\n",
    "df = pd.read_csv('data/distilbert-usa.csv', low_memory=False)\n",
    "\n",
    "df['Created At'] = pd.to_datetime(df['Created At'], errors='coerce')\n",
    "# remove rows where 'Created At' is NaT\n",
    "df = df.dropna(subset=['Created At'])\n",
    "\n",
    "df['Month_Year'] = df['Created At'].dt.strftime('%m/%Y')\n",
    "df.head()\n",
    "\n",
    "df.to_csv('data/distilbert-usa.csv', index=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "829d418b",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "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.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}