From 5a73b9849453a7275fa28ce069d15ffdf1b21dc4 Mon Sep 17 00:00:00 2001
From: jakub_szczegiecki <s172580@student.pg.edu.pl>
Date: Mon, 29 Nov 2021 15:33:30 +0100
Subject: [PATCH] Added file timestamp.ipynb

---
 timestamp.ipynb | 56 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)
 create mode 100644 timestamp.ipynb

diff --git a/timestamp.ipynb b/timestamp.ipynb
new file mode 100644
index 0000000..d658d72
--- /dev/null
+++ b/timestamp.ipynb
@@ -0,0 +1,56 @@
+{
+ "cells": [
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "id": "39fc9501",
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "import datetime\n",
+    "import numpy as np\n",
+    "import pandas as pd\n",
+    "\n",
+    "# Plik potrzebuje ramki danych df wygenerowanej jako zapytanie SQL\n",
+    "\n",
+    "timestamp1 = df[\"TIMESTAMP\"].astype('datetime64[ns]')\n",
+    "\n",
+    "hour = timestamp1.astype('datetime64[ns]').dt.hour.astype(int)\n",
+    "minute = timestamp1.astype('datetime64[ns]').dt.minute.astype(int)\n",
+    "second = timestamp1.astype('datetime64[ns]').dt.second.astype(int)\n",
+    "microsecond = timestamp1.astype('datetime64[ns]').dt.microsecond.astype(int)\n",
+    "\n",
+    "millisecond = microsecond/1000+second*1000+minute*60000+hour*3600000\n",
+    "delta_ms = millisecond - millisecond[0]\n",
+    "delta_ms\n",
+    "\n",
+    "timestamp = pd.DataFrame()\n",
+    "timestamp = pd.concat([timestamp1, hour, minute, second, microsecond, delta_ms], axis = 1)\n",
+    "timestamp.columns = ['timestamp', 'hour', 'minute', 'second', 'microsecond', 'delta_ms']\n",
+    "\n",
+    "timestamp"
+   ]
+  }
+ ],
+ "metadata": {
+  "kernelspec": {
+   "display_name": "Python 3",
+   "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.8.8"
+  }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5
+}
-- 
GitLab