Update analysis_notebook_hashtag.ipynb

Fix of date time transformation for date specific filtering.
This commit is contained in:
Almex
2024-09-12 09:48:05 +02:00
committed by GitHub
parent 831e1658cd
commit c14d637b2f

View File

@@ -89,7 +89,7 @@
"source": [ "source": [
"# Changes 'created_at' to data format datetime64[ns, tzlocal()]\n", "# Changes 'created_at' to data format datetime64[ns, tzlocal()]\n",
"# That is necessary for date specific filtering\n", "# That is necessary for date specific filtering\n",
"df['created_at'] = pd.to_datetime(df['created_at'], utc=True)\n", "df['created_at'] = pd.to_datetime(df['created_at'], errors='coerce', utc=True)\n",
"\n", "\n",
"# Adding the column 'instance' by extracting the domain name (and suffix) from the column 'url' of the post\n", "# Adding the column 'instance' by extracting the domain name (and suffix) from the column 'url' of the post\n",
"df['instance'] = df['url'].apply(lambda x: urlparse(x)[1])" "df['instance'] = df['url'].apply(lambda x: urlparse(x)[1])"